Listview attribute usage, listview attribute

Source: Internet
Author: User

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"


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.