Wednesday, January 11, 2012

How to customize the text in a list on android

To create some of the simplest customizations to your lists just edit the xml layout file found in the res/layout subfolder.
Sample Snippet
<listview android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textSize="18dp"
android:padding="6dp"
android:textColor="@color/lt_green"
android:background="@color/blue"
/>

As you can see from the above snippet modifying the text size, color and padding for all entries in a list is seemingly easy. Now however if you wish to customize further. Such as alternating the background color we will need to modify the code and overwrite SimpleAdapter and override the getView method.
That will be the subject of the next blog.

No comments:

Post a Comment