如何更改列表活动列表的默认外观?

时间:2013-04-23 20:15:13

标签: android

我创建了一个列表活动类并创建了一个数组适配器。但是,如何更改运行时生成的列表的外观。如何改变颜色,风格等。

提前谢谢。

2 个答案:

答案 0 :(得分:1)

您可以在styles.xml文件夹中创建values,然后执行类似

的操作
<!-- ListView -->
<style name="List_Item" parent="@android:style/Widget.ListView">
    <item name="android:background">@drawable/list_item_bg</item>  // if you have a drawable you want to use
    //add whatever other attributes you want
</style>

然后在你的ListView delcare你的风格的xml中

 <ListView 
    android:id="@+id/listID"
    android:layout_width="match_parent"  
    android:layout_height="wrap_content"
    android:layout_below="@+id/search_plate"
    style="@style/List_Item"/>    //here you implement your style

答案 1 :(得分:0)

您可以使用Theme & StylesListView和xml属性或ListView中的任何视图