The ListView is a control we often use, but in use for a variety of reasons can not set the effect we need, now the commonly used settings are recorded to facilitate later query.
1. The background turns black when dragging
Android:cachecolorhint= "#00000000"
2. Invalid after setting the Listselector
Android:drawselectorontop= "true"
3.listSelector indicates the selected background image, sometimes we need to set the pressed background (not checked), you need the following settings:
① first create an XML file under the Drawable folder and name it list_select:
<? XML version= "1.0" encoding= "Utf-8" ?> < xmlns:android= "http://schemas.android.com/apk/res/android"> <android:state_pressed= "true" android:drawable= "@ Drawable/activity_main_setting_press "/> </selector>
Activity_main_setting_press is the background image when pressed
② is quoted in the ListView as follows:
Android:listselector= "@drawable/list_select"
4. The above 3 description can also set the background color, such as:
<? XML version= "1.0" encoding= "Utf-8" ?> < xmlns:android= "http://schemas.android.com/apk/res/android"> <android:state_pressed= "true" android:drawable= "@color /gray "/> </selector>
The above gray must be configured in the Values-colors file
5. After setting up as above 4, it is possible that the background or background can not be displayed to obscure the former text content, you need to check whether the ListView item item sets the background color, you must clear the background color.
Android ListView Common Configuration Instructions