2012-03-17 62 views
0

設置顏色我只是想目前谷歌樣品ExpandableListiew:http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList1.html用於擴展列表

此示例看起來非常簡單,易於使用。

但我想要做的是說改變背景顏色的子元素和組元素。 它不使用任何child_row.xml,group_row.xml。 請告訴我正確的做法。

非常感謝任何信息。

+0

參考此連結http://techdroid.kbeanie .COM/2010/09/expandablelistview-上的Andr ?? oid.html – Aerrow 2012-03-17 05:36:59

回答

0

您可以定義新的樣式類似下面的擴展列表視圖...

<style name="Widget.MyExpandable" parent="android:Widget.ExpandableListView"> 
     <item name="android:listSelector">@drawable/list_selector_background</item> 
     <item name="android:divider">@color/ex_listview_stroke</item> 
     <item name="android:cacheColorHint">@color/color_foreground</item> 
     <item name="android:dividerHeight">0.5dp</item> 
</style> 

在聽到list_selector_background是繪製選擇文件,在其中您可以定義多個國家的EXList視圖像機架和壓制等...,

和對兒童和家長,你需要創建childview.xml和parentview.xml獨立...繪製背景文件不同的背景

+0

非常感謝 – 2012-03-17 09:47:34