您的位置:首页 > 其它

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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐