How to change the appearance of a ListView?

I have three main things that I want to change with the advent of ListView. 1) get rid of horizontal dividers that print between elements 2) change the font size of the test displayed in the list 3) change the registration around each displayed element

It seems that after reading for a while that 2) and 3), you need to control by changing these properties for the TextView used by ListView, but I still do not understand how to do this. Can someone answer these questions in a little more detail?

+3
source share
2 answers

1) 0 --- setDividerHeight (0) --- setDivider ( ColorDrawable (0x00FFFFFF))

2) , , ArrayAdapter, . - res/layout test_text.xml

<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize=<SIZE IN SP>
android:textColor="#FFF" />

3)

<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text"
android:padding="5dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize=<SIZE IN SP>
android:textColor="#FFF" />

ArrayAdapter

eg.
ArrayAdapter(Context context, int resource, int textViewResourceId, List<T> objects)

ArrayAdapter<String> myAdapter = new ArrayAdapter<String>(this, R.layout.test_text, R.id.text, myData);
+3

. , .

, - , , - , , .

ListView XML , , setTheme() , setContentView().

EDIT: , kcoppock - , .

+2

Source: https://habr.com/ru/post/1780076/


All Articles