Android – 0101 Attributes of ListView to keep in mind

By -

If you are knowing and has already worked with Android ListView, then these are the attributes you should know and use inside your android application to give a great look & feel to ListView. FYI, i have noted down these attributes as mostly used, i know there are some attributes also we can set while using ListView like android:footerDividersEnabled and andorid:headerDividersEnabled. So these below 6 are the attributes mostly used:

0000. android:background
It is used to set background resource to the ListView. Resources can either be color or image.

0001. android:listSelector
It is used to set Selector to the ListView, it is generally Orange Color or Sky blue color mostly. So you can also define your custom color/image as a list selector as per your design.

0010. android:cacheColorHint
It indicates that this list will always be drawn on top of solid, single-color opaque background. To disable the optimization, simply use the transparent color #00000000. Here is a nice information given for ListView Backgrounds Optimization, you should atleast go through once.
It defines the choice mode means at a time how many items you can select at a time. By default, ListView don’t have any choice made implemented. By setting the choiceMode:
By setting the choiceMode To singleChoice, the list allows up to one item to be in a chosen state.
By setting the choiceMode To multipleChoice, the list allows any number of items to be chosen.
By setting the choiceMode to multipleChoiceModal the list allows any number of items to be chosen in a special selection mode.

0100. android:divider
It defines the Divider to be displayed in between two ListView items.

0101. android:dividerHeight
It defines the Divider Height.

For example:
This is just a basic example to make you explain, you can take any color/image resources:

Paresh Mayani

Lazy android developer, exploring the horizon of android development since 7 years, currently working as a Technical Lead - Android at Simform Solutions, India. Former Application Architect at KarConnect. He is the Head/Organizer of Google Developers Group (GDG), Ahmedabad

Loading Facebook Comments ...
Loading Disqus Comments ...