android listactivity background color

android, background-color, listactivity

Solution

set `layout_height` to `fill_parent` in the xml file that contain your listview. and set background of that xml file what ever you want.

EDIT : you can use theme to set background in this case

like this

<style name="MyTheme">

    <item name="android:background">@color/darkbluelogo</item>

</style>

and apply this theme to your list activity in manifest file.

    <activity
        android:theme="MyTheme"

Problem

How can I set the background color of a listactivity? I can set the background color of the listview items but not the hole Activity-View (see the black part on the bottom of the image). How can I achieve that? The ListActivity XML looks like this: ``` <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="5dp" android:background="@color/darkbluelogo" > <ImageView android:id="@+id/list_image" android:layout_width="48dip" android:layout_height="48dip" android:contentDescription="@id/list_image" /> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="5dp" android:background="@color/darkbluelogo" android:scrollingCache="false" android:cacheColorHint="#00000000" > <TextView android:id="@+id/title" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@+id/title" > </TextView> <TextView android:id="@+id/datetime" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@+id/datetime" > </TextView> </LinearLayout> </LinearLayout> ``` And that is how it appears on the device: SOLUTION: I had to add a style XML and add this to the activity in the AndroidManifest.xml This was the correct answer: https://stackoverflow.com/a/10426474/1306012

Original source