2011三月9
控制ListView上下阴影条颜色
其实要实现这一功能点并不难,不过注意的地方还挺多的,否者总会有各种问题,废话不多说了,直接上代码。
下面是ListView的布局文件:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView android:id="@+id/listview" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:cacheColorHint="#00FF0000" />
</LinearLayout>
下面是ListView中的item布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll" android:layout_width="match_parent"
android:layout_height="50dp" android:background="#cccccc">
<TextView android:layout_width="match_parent"
android:layout_height="match_parent" android:text="测试 textview"
android:gravity="center_vertical" android:textSize="22dp"
android:textColor="#333333" android:background="@drawable/textview" />
</LinearLayout>
下面是item的背景样式
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/btn_check_off_disable_focused" /> <item android:drawable="@drawable/btn_check_off_pressed" /> </selector>
文章作者:admin
本文地址:http://www.zmkm.info/archives/184
版权所有 © 转载时必须以链接形式注明作者和原始出处!

