I am aware that I can set the background color of a ListView dynamically through some variation of the following code:
ListView mainListView;
mainListView = (ListView) findViewById( R.id.listView1 );
mainListView.setBackgroundColor(Color.BLACK);
However, I would like to do the identical thing through XML instead. I tried the following code without any luck (it makes no changes):
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
**android:background="#FFFFFF"**
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" >
</ListView>
</RelativeLayout>
Does anyone know of a simple way to change the background color of a ListView via XML?