JAVA/android_studio 2024. 3. 14. 09:43

 

https://stackoverflow.com/questions/20456393/how-to-change-text-size-of-listview

 

how to change text size of listview

I am using List Activity to retrieve data from SQLITE. But I can not set the font size of list view. Please help me. public class CartList extends ListActivity { private ArrayList<String>

stackoverflow.com

 

- source code :

Go into layout folder and create a new xml file named mytextview.xml(whatever you want to name it)

    <?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"
        android:textSize="12dp" />

 

in the code

    setListAdapter(new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1, results));

change it to

    setListAdapter(new ArrayAdapter<String>(this,
            R.layout.mytextview, results));
posted by cskimair
: