Change font size in ListView - Android/Eclipse

2 ways to go:

  1. Copy simple_list_item_1.xml from Android sources, modify it and then use it instead of android.R.layout.simple_list_item_1;
  2. Use BaseAdapter and modify font size in getView(..) call.

I'd suggest you go with latter.


Please create another file named list_item.xml

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:padding="6dp"
    android:textSize="21sp">


Go into layout create a new xml file named mylist.xml

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
 android:id="@android:id/text1"  
        android:paddingTop="2dip" 
        android:paddingBottom="3dip" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" /> 

now in the code

        adapter = new ArrayAdapter<String> (this,android.R.layout.simple_list_item_1,HistoryList);

change it to

        adapter = new ArrayAdapter<String> (this,R.layout.mylist,HistoryList);