如何制作这样的GridView touchfeedback?
我试过这个,但它仍然不起作用,因为我无法获得任何触摸反馈。
<GridView
android:id="@+id/GridView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_weight="1"
android:cacheColorHint="@android:color/transparent"
android:fadingEdge="none"
android:horizontalSpacing="1dp"
android:listSelector="@drawable/touch_listener"
android:numColumns="2"
android:scrollbars="none"
android:background="#000"
android:verticalSpacing="2dp" />
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/yellow" android:state_selected="true"/>
<item android:drawable="@color/transparent"/>
答案 0 :(得分:4)
在gridview xml中使用android:drawSelectorOnTop
<GridView
android:id="@+id/GridView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_weight="1"
android:cacheColorHint="@android:color/transparent"
android:fadingEdge="none"
android:horizontalSpacing="1dp"
android:listSelector="@drawable/touch_listener"
android:numColumns="2"
android:scrollbars="none"
android:background="#000"
android:verticalSpacing="2dp"
android:drawSelectorOnTop="true" />