博客
关于我
UI学习之点击或聚焦 或失去焦点的时候变换样式
阅读量:371 次
发布时间:2019-03-05

本文共 1550 字,大约阅读时间需要 5 分钟。

 在drawable文件夹

diff_bg.xml

<?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/focus"/>

    <item  android:state_selected="true" 

    android:drawable="@color/focus"/>

    <item  android:state_focused="true" 

    android:drawable="@color/focus"/>    

 

</selector>

layout文件夹中mail.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:mobile="http://net.blogjava.mobile"
    android:orientation="vertical"
    android:background="@drawable/
proback"
    
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<com.android.projector.IconTextView
    android:text="@string/on_projector"
    android:id="@+id/on_projector"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="100dp"
    android:background="@drawable/
diff_bg"
    android:textStyle="bold"
    android:clickable="true"
    android:focusable="true"
    android:selectable="true"
     style="@style/MayStyle"
    mobile:iconSrc="@drawable/open"
    />
<com.android.projector.IconTextView
    android:text="@string/down_projector"
    android:id="@+id/down_projector"
    android:layout_below="@id/on_projector"
    android:layout_marginTop="20dp"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textStyle="bold"
    android:clickable="true"
    android:focusable="true"
    android:selectable="true"
    android:background="@drawable/
diff_bg"
     style="@style/MayStyle"
    mobile:iconSrc="@drawable/close"
    />
    
</RelativeLayout>

转载地址:http://hgsg.baihongyu.com/

你可能感兴趣的文章
Mysql 数据类型一日期
查看>>
MySQL 数据类型和属性
查看>>
mysql 敲错命令 想取消怎么办?
查看>>
Mysql 整形列的字节与存储范围
查看>>
mysql 断电数据损坏,无法启动
查看>>
MySQL 日期时间类型的选择
查看>>
Mysql 时间操作(当天,昨天,7天,30天,半年,全年,季度)
查看>>
MySQL 是如何加锁的?
查看>>
MySQL 是怎样运行的 - InnoDB数据页结构
查看>>
mysql 更新子表_mysql 在update中实现子查询的方式
查看>>
MySQL 有什么优点?
查看>>
mysql 权限整理记录
查看>>
mysql 权限登录问题:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)
查看>>
MYSQL 查看最大连接数和修改最大连接数
查看>>
MySQL 查看有哪些表
查看>>
mysql 查看锁_阿里/美团/字节面试官必问的Mysql锁机制,你真的明白吗
查看>>
MySql 查询以逗号分隔的字符串的方法(正则)
查看>>
MySQL 查询优化:提速查询效率的13大秘籍(避免使用SELECT 、分页查询的优化、合理使用连接、子查询的优化)(上)
查看>>
mysql 查询数据库所有表的字段信息
查看>>
【Java基础】什么是面向对象?
查看>>