I use a selector to animate my views, and in one of them I do like this:
View:
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:weightSum="1" android:background="@drawable/selector_gridview" >
selector_gridview:
<?xml version="1.0" encoding="UTF-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="false" android:drawable="@drawable/selector_gridview_normal" /> <item android:state_pressed="true" android:drawable="@drawable/selector_gridview_pressed" /> </selector>
selector_gridview_pressed:
<?xml version="1.0" encoding="UTF-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape> <solid android:color="@color/overlayed" /> <stroke android:width="1px" android:color="#cccac3" /> </shape> </item> <item> <bitmap android:antialias="true" android:dither="true" android:src="@drawable/bg_stripes_dark" android:tileMode="repeat" /> </item> </layer-list>
bg_stripes_dark is a .png located in the drawable-nodpi .
The bitmap is the same for selector_gridview_normal and selector_gridview_pressed , but when you click on the view, the bitmap does not repeat as if it had not been clicked.
I am using MDPI / API 8 device , in 4.0 devices (and therefore) this problem does not exist.
This seems like a problem with v4 Gridview support. In fact, he has a lot of problems. Is there any way to solve this?
source share