Android 2.3 - selector's src won't work with ImageView if it isn't used in the main activity

StackOverflow https://stackoverflow.com/questions/15508896

  •  24-03-2022
  •  | 
  •  

Question

I have a simple selector for ImageButton placed on the not main activity:

<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:drawable="@drawable/image_press" />
    <item android:drawable="@drawable/image" />
</selector>

If I use it on the main activity, it will work in the second too. But if not, ImageButton on the second activity will became gone on Android 2.3 (works fine with later versions). How can I fix it? Setting @drawable/image (not selector) works fine despite of using it on the main activity. Problem is with selector.

Was it helpful?

Solution

Oh… it was a strange bug. I created a copy of old file and it helped.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top