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.

Thursday, January 5, 2012

Holidays

The holidays kept me busy so I did not post anything. I also spent some time delving into html and css to create some webpages.
I have found alot of examples on changing the listview in Android to customize the color of the background. I am cobbling together a sample using an alternating background color with data from sqlite.