Listview attribute usage, listview attribute
I recently studied the problem of listview interaction. Alas, it's disgusting. After two days, the problem is that the two listview cannot select the same item at the same time and use event distribution, however, there were always two clicks, and they were also drunk. They also studied event distribution and were drunk. But fortunately, Jin Lin recommended a foreign video!
The following describes how to use listview.
1. First, let's look at the most primitive, without any effect.
2. every item is very closely separated and looks very crowded. Therefore, we add android: dividerHeight = "10dp" to separate each item by 10 DP, which looks less crowded, of course, you can also use other methods. There are many methods. Here we just discuss the listview
3. In order to look less ugly, we remove the shadow from android: divider = "@ null"
4. our listview will show a scroll bar in a slide way, but the length of the scroll bar will become shorter as the data increases. Therefore, in many cases, the android: scrollbars = "none" (similarly, android: scrollbars = "horizontal" displays a scroll bar when scrolling horizontally)
5. When the data volume is large, we need to use the android: fastScrollEnabled = "true"
6. when data is updated, the updated content is displayed after the listview. When the data volume is large, we want to see the updated content, therefore, the following android: stackFromBottom = "true" needs to be displayed in listview"
7. listview has a default system color in the sliding mode. We usually set it to transparent android: cacheColorHint = "#00000000". Here I set a red color for convenience of viewing.
8. When there is a shadow on the top and bottom of the listview, use android: fadingEdge = "none"
9. When you click listview to select an item, android: listSelector = "@ color/red"