Important attributes of Android listview

Source: Internet
Author: User

FirstYesStackfrombottomAttributeThe list you prepared after this attribute is displayed at the bottom of your list. The values are true and false.

Android: stackfrombottom = "true"


SecondYesTransciptmode attributeYou need to use listview or other controls that display a large number of items to track or view information in real time, and want the latest entries to automatically scroll to the visible range. By setting the transcriptmode attribute, You can automatically slide the Android platform control (scrollbar supported) to the bottom.
Android: transcriptmode = "alwaysscroll"


third cachecolorhint attribute , many people want to change its background so that it can conform to the overall uidesign, to change the background, you only need to prepare an image and specify the attributes Android: Background =" @ drawable/BG " but don't be too happy. When you do this, you will find that the background has changed, but when you drag, you can also click the blank position in the list to find that all listitems are black, damaging the overall effect.

If you only change the background color, you can directly specifyAndroid: cachecolorhintIf you use an image as the background, you only need to setAndroid: cachecolorhintSpecify as transparent (#00000000)You can.


FourthDivider attributesThis attribute is used to set an image between each item as an interval or remove the split line between items.

Android: divider = "@ drawable/list_driver"@ Drawable/list_driver is an image resource. If you do not want to display the split line, set itAndroid: divider = "@ drawable/@ null"You can.


FifthFadingedge attributes, Black shadow on top and bottom

Android: fadingedge = "NONE"No shadow after setting ~


SixthScrollbars attributesTo hide the listview scroll bar,

Android: scrollbars = "NONE" and setverticalscrollbarenabled (true,Hidden during non-activity and during activity


SeventhFadescrollbars attributes, Android: fadescrollbars = "true" When configuring the listview layout, set this attribute to true to automatically hide and display the scroll bar.


EighthFastscrollenabled attribute,

Many developers do not know how to enable the quick scroll slider of the listview list control. Here, the android Development Network tells you that the secondary scroll slider only needs one row.CodeThis can be done. If you use XML layout, you only need to add the Android: fastscrollenabled = "true" attribute to the listview node. For Java code, you can use mylistview. setfastscrollenabled (true); to control enabling. The false parameter is hidden. Another point is that when your scrolling content is small and you do not reach the three screen heights of the current listview, this quick scroll slider does not appear, and this method is still the basic method of abslistview, you can use Quick scrolling assistance in listview, gridview, and other subclasses.


NinthDrawselectofftop attributes

When set to true, the selector will be drawn over the selecteditem. Otherwise the selector is drawn behind the selected item. thedefault value is false.

Android: drawselectid Top = "true" Click a record. The color is displayed on the top of the record, and the recorded text is hidden. If you click the text, the text will not be displayed.

Android: drawselectid Top = "false" click a record, and the color will be behind the record. The background color is displayed, but the recorded text is visible.

 

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.