Several important properties of Android ListView

Source: Internet
Author: User

because of these two days in doing the ListView thing, so sort out some of my personal think more special properties, by setting such a property can make a more beautiful list first is the Stackfrombottom property, which only after this property you do a good list will show you the bottom of the list, A value of true and Falseandroid:stackfrombottom= "true"The second is the Transciptmode property, which needs to be tracked or viewed in real time with a ListView or other control that displays a large number of items, and you want the latest entries to automatically scroll to the viewable range. By setting the Control Transcriptmode property, you can automatically slide the controls on the Android platform (support ScrollBar) to the bottom. Android:transcriptmode= "Alwaysscroll"The Third Cachecolorhint attribute, many people want to be able to change its background, so that he can conform to the overall UI design, change the background is very simple only need to prepare a picture and then specify the properties Android:background= "@drawable/bg", but do not be happy too early, when you do this, you find that the background is changed, but when you drag, or click on the list blank position when the ListItem has become black, destroying the overall effect. If you just change the color of the background, you can specify Android:cachecolorhint as the color you want, if you are using a picture to do the background, it is as long as the android:cachecolorhint is specified as transparent (#00000000The fourth Divider property, the function of which is to set a picture between each item as an interval, or to remove the split line between items Android:divider= "@drawable/list_driver" where @drawable/list_driver is a picture resource, if you do not want to display the split line, set to Android:divider= "@drawable/@null"you can have it. The fifth Fadingedge property, with black shadows above and below Android:fadingedge= "None" has no shadow after setting ~The sixth ScrollBars property, which is to hide the scroll bar of the ListView, Android:scrollbars= "None" with setverticalscrollbarenabled (true); the effect is the same, not active when hidden, when the activity also hides the Seventh Fadescrollbars property, Android:fadescrollbars= "true"when configuring the ListView layout, setting this property to True enables the auto-hide and display of scroll bars. The eighth fastscrollenabled attribute, many developers do not know how the ListView list control's Quick scroll slider is enabled, here the Android Development network tells you, the auxiliary scroll slider only needs one line of code to be able to take care of, If you use an XML layout, you only need to add android:fastscrollenabled to the ListView node= "true" for this property, while Java code can be passed mylistview.setfastscrollenabled (true); To control enable, the parameter false is hidden. Another thing is that when your scrolling content is small, this quick scroll slider does not appear when you are less than the 3 screen height of the current ListView, and the method is still the underlying method of Abslistview, and you can use fast scrolling assistance in subclasses such as the ListView or GridView. Nineth Drawselectorontop Property When set totrue, the selector is drawn over the SelectedItem. Otherwise The selector is drawn behind the selected item. Thedefault value isfalse. Android:drawselectorontop= "true"Click on a record, the color will be displayed on the top, the text on the record is obscured, so click on the text, text will not see Android:drawselectorontop= "False" click on a record, the color will be behind the record, the background color, but the text of the recorded content is visible

Several important properties of Android ListView

Related Article

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.