Android Gallery Item Selector

I want to use the following selector that can be cut out for an Android gallery image, will it work?

<selector xmlns:android="http://schemas.android.com/apk/res/android">
     <item state_selected="true" android:drawable="@drawable/selected_icon" >
     </item>

    <item
        android:drawable="@drawable/unselected_icon" >
    </item>

</selector>

I tried, but it does not work

+3
source share
1 answer

I can fix it myself.

The same xml file worked as shown above, only the difference matters under

make sure that the selected and unselected images have the same height and width, otherwise they will not work.

+2
source

Source: https://habr.com/ru/post/1750291/


All Articles