android listview background color stays gray, cannot be changed on gingerbread phone
I have a simple listview on my page.
<ListView
android:id="@+id/dinerListView"
android:layout_width="fill_parent"
android:layout_height="150dip"
android:layout_weight=".40"
android:background="@drawable/backrepeat"
android:cacheColorHint="#00000000"
android:layout_alignParentTop="true" />
No matter what I set the background to - whether it be an image or a color, it stays grey. If I populate the listview with rows, the rows background color shows up appropriately.
This behavior ONLY exhibits itself on a gingerbread phone (droid x and droid 3 so far). Within the simulator and 开发者_如何学Goother Froyo phones, it works fine.
Try setting android:overScrollFooter="@null"
in your ListView's layout.
How to draw a ListView in OS v2.3.3 and above so that the extra space below your last row item displays your specified background instead of the new gray default footer background color:
overScrollFooter
is unacceptable to most builds.
height="wrap_content"
by itself only works if there are no other widgets below your ListView.
Removing layout_alignParentBottom="true"
can work, but can also damage the screen layout depending on the ListView's relationship with other widgets.
The most straightforward way to reduce the height of your ListView so there is no extra footer space that Motorola OS v2.3 wants to paint gray, is to wrap the ListView in another Layout such as a LinearLayout. Make the LinearLayout whatever size you wish and reduce the height
of the internal ListView to "wrap_content"
. If you want more explanation and an example, navigate here: List View Footer Background on Android 2.3.3.
You can create a layout that contains the listview and then set the background to the image/color you want. Then put wrap_content property for the layout and put it under the main layout of the activity.
精彩评论