博客
关于我
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/

你可能感兴趣的文章
Linux下的系统监控与性能调优:从入门到精通
查看>>
LiveGBS user/save 逻辑缺陷漏洞复现(CNVD-2023-72138)
查看>>
Mysql Can't connect to MySQL server
查看>>
MySQL InnoDB引擎的锁机制详解
查看>>
MySQL Xtrabackup 安装、备份、恢复
查看>>
mysql 优化器 key_mysql – 选择*和查询优化器
查看>>
MySQL 优化:Explain 执行计划详解
查看>>
mysql 修改默认字符集为utf8
查看>>
Mysql 共享锁
查看>>
mysql 写入慢优化
查看>>
mysql 创建表,不能包含关键字values 以及 表id自增问题
查看>>
mysql 判断表字段是否存在,然后修改
查看>>
MySQL 多表联合查询:UNION 和 JOIN 分析
查看>>
MySQL 大数据量快速插入方法和语句优化
查看>>
mysql 如何给SQL添加索引
查看>>
mysql 字段区分大小写
查看>>
mysql 字段类型类型
查看>>
MySQL 存储引擎
查看>>
mysql 更新子表_mysql 在update中实现子查询的方式
查看>>
mysql 自增id和UUID做主键性能分析,及最优方案
查看>>