Android ListView some important attributes _android

Source: Internet
Author: User

The first is the Stackfrombottom attribute, the list that you do well after this property will display the bottom of your list, and the value is true and false.

Android:stackfrombottom= "true"

The second is the Transciptmode property, which needs to be tracked or viewed in real time with ListView or other controls that display a large number of items, and you want the latest entries to automatically scroll to the visual range. By setting the Control Transcriptmode property, you can automatically slide the control of the Android platform (support ScrollBar) to the bottom.
Android:transcriptmode= "Alwaysscroll"

The third Cachecolorhint property, many people want to be able to change its background, so that he can meet the overall UI design, change the background is very simple only need to prepare a picture and then specify the attributes android:background= "@drawable/bg", But do not be happy too early, when you do so, found that the background is changed, but when you drag, or click on the list blank position when the ListItem have become black, destroying the overall effect.

If you just change the color of the background, you can directly specify Android:cachecolorhint for the color you want, if you are using a picture to do the background, it also as long as the android:cachecolorhint specified as transparent (#00000000) on it

The Divider property, which is the function of each item needs to set a picture as an interval, or remove the line between the item

android:divider= "@drawable/list_driver" where @drawable/list_driver is a picture resource, set to android:divider= if you do not want to show the split line drawable/@null "It's okay.

Fifth Fadingedge property, with black shadows above and below

No shadow after android:fadingedge= "none" setting ~

The sixth ScrollBars property, which is to hide the ListView scroll bar,

Android:scrollbars= "None" and setverticalscrollbarenabled (true); the effects are the same, hidden when inactive, and hidden when active.

Seventh Fadescrollbars property, when android:fadescrollbars= "true" configures ListView layout, this property is set to true to enable automatic hiding and display of scroll bars.

Eighth Fastscrollenabled Property,

Many developers do not know how the fast scrolling slider for the ListView list control is enabled, and the Android Development Network tells you that the secondary scrolling slider can be done with just one line of code, and if you use an XML layout you only need to add Android to the ListView node: Fastscrollenabled= the property "true" and the Java code can pass mylistview.setfastscrollenabled (true); To control enabled, the parameter false is hidden. The other thing is that when your scrolling content is small and you don't get to the 3 screen heights of the current ListView, the Quick Scroll slider does not appear, and the method is still the Abslistview base method for using fast scrolling support in subclasses such as ListView or GridView.

Nineth Drawselectorontop Property

When set to True, the selector is drawn over the SelectedItem. Otherwise the selector is drawn behind the selected item. Thedefault value is false.

Android:drawselectorontop= "True" click on a record, the color will be displayed on the top, the record on the text is covered, so click on the text, text can not see

Android:drawselectorontop= "false" clicks on a record, the color is behind the record, it becomes the background color, but the text of the record content is visible

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.