android listview交替颜色,android – 如何设置Listview交替行颜色和选定项目背景颜色...
试试这样吧artists_list_backgroundcolor.xmlandroid:state_selected="false"android:state_pressed="false"android:drawable="@color/normal" />android:drawable="@color/itemselected" />android:state_pressed=
·
试试这样吧
artists_list_backgroundcolor.xml
android:state_selected="false"
android:state_pressed="false"
android:drawable="@color/normal" />
android:drawable="@color/itemselected" />
android:state_pressed="false"
android:drawable="@color/itemselected" />
colors.xml
#ffffff
#EDEDED
并在getView()中使用它
if (position % 2 == 0) {
view.setBackgroundResource(R.drawable.artists_list_backgroundcolor);
} else {
view.setBackgroundResource(R.drawable.HERE_FOR_ALTERNATE);
}
希望这会帮助你.
更多推荐
已为社区贡献2条内容
所有评论(0)