ListView 设置点击项目背景色
来源:互联网 发布:聚宝盆计划软件下载 编辑:程序博客网 时间:2024/05/21 22:44
<strong style="color: rgb(255, 102, 102); font-family: Arial, Helvetica, sans-serif;font-size:24px;">第一步</strong>
<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">首先,定义一个ListViewSelectColor选择背景色,</span>
文件名:list_bg_selector
位 置 :drawable\
<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@color/ItemClick"></item> <item android:drawable="@android:color/white"></item></selector>
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 24px; color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255);"><strong>第二步</strong></span></span>接着,定义一个color颜色
文件名:color
位 置 :values\
<?xml version="1.0" encoding="utf-8"?><resources> <color name="white">#ffffff</color> <color name="black">#000000</color> <color name="green">#00ff00</color> <color name="ItemClick">#F0F0F0</color></resources>
<span style="font-family:Arial, Helvetica, sans-serif;font-size:24px;color:#ff6666;"><span style="background-color: rgb(255, 255, 255);"><strong>第三步</strong></span></span>定义一个ListItem
文件名:list_item
位 置 :layout\
<?xml version="1.0" encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent"android:layout_height="fill_parent"android:gravity="center_vertical"android:orientation="horizontal" android:background="@drawable/list_bg_selector"><ImageView android:id="@+id/entryImageView1" android:layout_width="35dp" android:layout_height="35dp" android:layout_marginLeft="10dp" android:background="@drawable/ic_launcher" /><TextView android:id="@+id/entryTextView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="10dp" android:text="This Item Names" android:textSize="25sp" /></LinearLayout>
<span style="font-family:Arial, Helvetica, sans-serif;font-size:24px;color:#ff6666;"><span style="background-color: rgb(255, 255, 255);"><strong>第四步</strong></span></span>设置ListView属性
<ListView android:id="@+id/listView2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@+id/SendMessage" android:background="@color/white" android:cacheColorHint="@android:color/secondary_text_light_nodisable" android:divider="@null" android:fastScrollEnabled="true" >
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 24px; color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255);"><strong>最后效果</strong></span></span>
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 24px; color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255);"><strong></strong></span></span>
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 24px; color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255);"><strong></strong></span></span>
1 0
- ListView 设置点击项目背景色
- listview设置item点击背景色
- button点击设置背景色
- listView 设置无背景色
- Android ListView点击行高亮(修改背景色)
- ListView中item点击去除背景色
- 去除ListView 点击默认背景色,混动背景色
- Android 中listview点击一个item时背景色的设置
- Android ListView的item背景色设置,item点击无响应
- Android ListView的item背景色设置和item点击无响应的解决方法
- android 设置listview item选中背景色
- android 设置listview item选中背景色
- Android ListView的item背景色设置
- Android ListView的item背景色设置
- 设置ListView列表项的背景色
- listview的row的背景色设置
- 点击listview的时候listitem不改变背景色
- Android ListView item点击后,背景色一直保持
- Linux用户和用户组管理
- nginx+tocmat 负载均衡时,一台tomcat宕机时的问题
- linux 安装Python 包
- ThinkPHP中自动验证时常用的正则表达式
- 如何高效的开发Android程序
- ListView 设置点击项目背景色
- 二叉查找树的简单创建和3种遍历
- tomcat服务最好部署在一个拥有最小权限的用户下
- Java反射入门
- android cmd
- Scala.runtime In Compiler Mirror Not Found 怎么解决
- 22. Generate Parentheses
- Linux _条件变量
- Linux_ pthread 线程的取消