listview改变选中行字体颜色
目标:选中item,其字体设置为#3197FF,未选中的,其字体为#FFFFFF
与listvew设置选中行item背景图片一样,使用selector,不过这里的颜色设置,应该是在listview中的textview中设置。
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TableRow >
<TextView
android:id="@+id/name_tv"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textSize="25px"
android:textColor="@drawable/itemcolor">
</TextView>
</TableRow>
</TableLayout>
同样,定义itemcolor.xml文件,修改选中行的字体颜色:
<?xml version="1.0" encoding="utf-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 没有焦点时字体颜色 -->
<item
android:state_selected="false"
android:color="#FFFFFF"/>
<!--选中时的字体颜色 -->
<item
android:state_selected="true"
android:color="#3197FF"/>
<!-- 非触摸模式下获得焦点并单击时的字体颜色 -->
<item
android:state_focused="true"
android:state_pressed="true"
android:color="#3197FF"/>
</selector>

listview改变选中行字体颜色的更多相关文章
- 【android】listview改变选中行背景图片
[android]listview改变选中行背景图片 目标:当item选中时,改变其背景图片.效果图如下: 直接在listview的xml文件中使用listselector: 1 2 3 4 5 6 ...
- WPF DataGrid ListView 等等 改变 选中行 颜色;以及 不变的原因
WPF中改变选中行的颜色是很简单的,就是用触发器:比如:以DataGrid为例: DataGrid.RowStyle Style TargetType= DataGridRow SetterPrope ...
- DEV GridControl.TableView FocusedRow选中行背景颜色
上次修改了TableView.RowStyle,导致了一个问题:覆盖了GridControl默认的选中行颜色. 于是需要重写选中行的颜色. 刚开始的想法是: <dxg:TableView> ...
- 【WPF】通过修改dataGrid的cell的style,改变选中行失去焦点时的颜色
<Style TargetType="{x:Type DataGridCell}"> <Style.Triggers> <Trigger Proper ...
- Silverlight 查询DataGrid 中匹配项 ,后台改变选中行颜色
需求:根据关键字(参会人号码或名称)查找参会人,在datagird 中高亮显示 界面:我在界面上增加了一个文本框和按钮,进行查找操作 操作说明: 根据关键字进行搜索:输入关键字 点击查找,如果找到 以 ...
- WPF 改变Datagrid的选中行的颜色
主要通过设置DataGrid的RowStyle和CellStyle即可. <Style TargetType="DataGridRow" x:Key="gridRo ...
- WPF,通过修改dataGrid的cell的style,改变选中行失去焦点时的颜色 4.0可用
<Style TargetType="{x:Type DataGridCell}"> <Style.Triggers> <Trigger Proper ...
- 使用Selector改变TextView的字体颜色textColor的方法
先上Selector文件,名字为singer_fragment_top_text_style.xml, <?xml version="1.0" encoding=" ...
- winform控件在Enable=false的情况下改变它的字体颜色
[System.Runtime.InteropServices.DllImport("user32.dll ")] public static extern int ...
随机推荐
- ZXing工具类v1.0
package com.jadyer.util; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import jav ...
- Android开发之SoundPool使用具体解释
使用SoundPool播放音效 假设应用程序常常播放密集.急促而又短暂的音效(如游戏音效)那么使用MediaPlayer显得有些不太适合了.由于MediaPlayer存在例如以下缺点: 1) ...
- []: secureCRT连接ubuntu问题- The remote system refused the connection
secureCRT连接ubuntu问题- The remote system refused the connection http://jxyang.iteye.com/blog/1484915 解 ...
- 基于visual Studio2013解决面试题之1003字符串逆序
题目
- Why Python?
Python is object-oriented Structure supports such concepts as polymorphism , operation overloading , ...
- 日积月累:ScrollView嵌套ListView只显示一行
在开发的过程当中,由于手机屏幕的大小的限制,我们经常需要使用滑动的方式,来显示更多的内容.在最近的工作中,遇见一个需求,需要将ListView嵌套到ScrollView中显示.于是乎有了如下布局: & ...
- jQuery Easy UI Resizable(调整大小)组件
Resizable(调整大小)组件,easyui基础组件之中的一个.调整大小就是能够对元素能够拖着调整大小,这个组件不依赖于其它组件,使用比較简单,相关的属性.事件都 在样例中介绍了. 演示样例: & ...
- 基于Linux的视频传输系统(上大学时參加的一个大赛的论文)
文件夹 1原创性声明----------------------------------------------------3 2 摘要-------------------------------- ...
- ASP.NET - 锚点跳转,用于回到顶部
<a name ="top"></a> <a href ="#top">回到顶部</a> 第一行代码写在顶部,第 ...
- ASP.NET - 页面传值 Request.QuerString[].ToString();
public partial class WebForm2 : System.Web.UI.Page { BLL.CategoryBLL categorybll = new CategoryBLL() ...