android - Setting the background on a selected listview? -


I have the following 2 layout files to display a list of contact groups I it looks right to see in normal state . My background is in semi-transparent inventory items when I list touch to move it to the background, but semi-transparent

gouplist.xml

  & lt stay away from the black, .? Xml version = "1.0" encoding = "utf-8" & gt; & Lt; LinearLayout xmlns: android = "Http://schemaskandroidkcom/apk/res/android" android: orientation = "vertical" android: Layout_width = "Fill_parent" Android: Layout_height = "Fill_parent" android: background = "@ drawable / Megaphone_320x480 "& gt; & Lt; ListView Android: id = "@ + ID / Android: list" Android: layout_width = "fill_parent" Android: layout_height = "fill_parent" /> & Lt; TextView android: id = "@ id / Android: blank" Android: Layout_width = "Fill_parent" Android: Layout_height = "Fill_parent" android: text = "No Group" / & gt; & Lt; / LinearLayout & gt;   

two_line_list.xml

  & lt ;? Xml version = "1.0" encoding = "utf-8" & gt; & Lt; LinearLayout xmlns: Android = "http://schemas.android.com/apk/res/android" Android: layout_width = "fill_parent" Android: layout_height = "fill_parent" & gt; & Lt; TextView android: id = "@ + id / lv_topText" Android: Layout_width = "Fill_parent" Android: Layout_height = "Wrap_content" Android: Textcolor = "# BBBBBB" android: background = "# 99000000" Android: textSize = "24sp" Android : Typeface = "without" Android: text style = "bold" /> & lt; TextView android: id = "@ + id / lv_bottomText" Android: Layout_width = "Fill_parent" Android: Layout_height = "Wrap_content" Android: Textcolor = "# BBBBBB" android: background = "# 99000000" Android: TextSize = "L8sp" Android : Typeface = "without" Android: Text Style = "bold" /> & lt; / LinearLayout & gt;    

cacheColorHint properties that should be set on the actual ListView. As 3dmg stated, it is usually the container will be set to the same background color as the ListView. In the example below, ListView will be within a LinearLayout whatever background a white (#fff).

  & lt; ListView android: id = "@ + id / Android: List" Android: layout_width = "fill_parent" Android: layout_height = "0dp" Android: layout_weight = "1.0" Android: cacheColorHint = "# FFF" / & gt;    

Comments