ListView 的Item更改背景图片
2013-04-19 17:34
211 查看
三个文件:
listview:
<!-- 列表开始 -->
<ListView
android:id="@+id/lv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="false"
android:layout_below="@id/currentitem"
android:layout_above="@id/GridView_toolbar"
android:layout_marginTop="5dp"
android:layout_marginBottom="-3dp"
android:dividerHeight="10dp"
android:divider="@null"
android:fastScrollEnabled="true"
android:cacheColorHint="#00000000"
android:focusable="true"
/>
<!-- 列表结束 -->
list_item:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/list_selector" >
....</RelativeLayout>
list_selector:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/course_list_background_pressed"
android:state_pressed="true"></item>
<item android:drawable="@drawable/course_list_background"
android:state_pressed="false"></item>
</selector>
listview:
<!-- 列表开始 -->
<ListView
android:id="@+id/lv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="false"
android:layout_below="@id/currentitem"
android:layout_above="@id/GridView_toolbar"
android:layout_marginTop="5dp"
android:layout_marginBottom="-3dp"
android:dividerHeight="10dp"
android:divider="@null"
android:fastScrollEnabled="true"
android:cacheColorHint="#00000000"
android:focusable="true"
/>
<!-- 列表结束 -->
list_item:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/list_selector" >
....</RelativeLayout>
list_selector:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/course_list_background_pressed"
android:state_pressed="true"></item>
<item android:drawable="@drawable/course_list_background"
android:state_pressed="false"></item>
</selector>
相关文章推荐
- listview中,点选item时,更改item背景图片以及item字体
- ListView条目点击时和点击后图片颜色、文字颜色、条目背景更改大全
- Android ListView item背景图片显示方式
- navigationItem.rightBarButtonItem 设置背景图片,颜色更改解决办法
- android ListView item 点击设置背景图片需要注意的问题
- navigationItem.rightBarButtonItem 设置背景图片,颜色更改解决的方法
- android ListView常见问题解决方法(滚动背景变黑,去除滑动时阴影,拖动时Item图片不显示)
- 选中ListView中的Item后,让Item的背景高亮显示为某张图片的实现
- 解决Android listview 设置item背景图片以后 当拉动listview的时候 整个listview变黑的解决办法
- ListView条目点击时和点击后图片颜色、文字颜色、条目背景更改大全
- 《如何更改其他程序ListView控件中某个Item的内容》 -- 天津 赵春生
- Android ListView滚动Item背景为黑色解决办法
- android中设置ListView的选中的Item的背景颜色
- ListView条目item中 添加按钮或者图片 弹出对话框
- Android 点击控件(比如ListView中item),抬起后,保持按下的背景颜色
- 控件实现点击预览图片更改页面背景图片的效果
- ,避免造成混乱。 设想1:拿ListView为例,如果ListView的ItemView复用机制,所有的ItemView复用同一个,如果在多线程下载图片的情况下,可能最终只有最后一个View显示图片
- 笔记48--ListView点击item,显示Dialog,选择Dialog,更改item的值
- 设置item背景图片
- ListView小知识整理:滑动背景、Item间隙等