Search...

Sunday, November 13, 2011

How to change the list item default look and feel in android


Step1: Create new xml for your list item.

e.g: my_list_item.xml

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingTop="11dp"
    android:paddingBottom="11dp"
    android:paddingLeft="23dp" android:textAppearance="@style/sans17white">
</TextView>

Step2: Use your xml to create adapter for the list view.

ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(
                        this,R.layout.my_list_item,myUtil.getCustommyCategory());

            myCategoryList.setAdapter(adapter);

No comments:

Post a Comment