Android gridview 點擊 顏色 XML設定
Android gridview 點擊 顏色 XML設定
資料來源:http://www.tqcto.com/article/mobile/136423.html
http://blog.csdn.net/top_code/article/details/13601625
http://www.lxway.com/896480646.htm (案例來源)
GridView.xml
<?xml <GridView xmlns:android=”http://schemas.android.com/apk/res/android“ android:id=”@+id/gridview“ |
grid_view_item.xml
<?xml – <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android“ android:layout_height=”wrap_content“ android:paddingBottom=”2dip“ android:layout_width=”fill_parent“ android:background=”@drawable/grid_view_item_selector_xml“> <ImageView android:layout_height=”wrap_content“ android:id=”@+id/ItemImage“ android:layout_width=”wrap_content“ android:layout_centerHorizontal=”true” /> <TextView android:layout_width=”wrap_content“ android:layout_below=”@id/ItemImage“ android:layout_height=”wrap_content“ android:text=”TextView01“ android:layout_centerHorizontal=”true“ android:id=”@+id/ItemText” </RelativeLayout> |
grid_view_item_selector_xml.xml
<?xml – <selector xmlns:android=”http://schemas.android.com/apk/res/android“> <item android:state_pressed=”true“ android:drawable=”@drawable/grid_view_item_press_shape” /> <item android:drawable=”@drawable/grid_view_item_shape” /> </selector> |
grid_view_item_press_shape.xml
<?xml – <shape xmlns:android=”http://schemas.android.com/apk/res/android“> <solid android:color=”#5500ffff” /> </shape> |
grid_view_item_shape.xml
<?xml – <shape xmlns:android=”http://schemas.android.com/apk/res/android“> <solid android:color=”#fff” /> </shape> |