博客
关于我
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原理简介—1.SQL的执行流程
查看>>
MySQL原理简介—10.SQL语句和执行计划
查看>>
MySQL原理简介—11.优化案例介绍
查看>>
MySQL原理简介—12.MySQL主从同步
查看>>
MySQL原理简介—2.InnoDB架构原理和执行流程
查看>>
MySQL原理简介—3.生产环境的部署压测
查看>>
MySQL原理简介—6.简单的生产优化案例
查看>>
MySQL原理简介—7.redo日志的底层原理
查看>>
MySQL原理简介—8.MySQL并发事务处理
查看>>
MySQL原理简介—9.MySQL索引原理
查看>>
MySQL参数调优详解
查看>>
mysql参考触发条件_MySQL 5.0-触发器(参考)_mysql
查看>>
MySQL及navicat for mysql中文乱码
查看>>
MySqL双机热备份(二)--MysqL主-主复制实现
查看>>
MySQL各个版本区别及问题总结
查看>>
MySql各种查询
查看>>
mysql同主机下 复制一个数据库所有文件到另一个数据库
查看>>
mysql启动以后会自动关闭_驾照虽然是C1,一直是开自动挡的车,会不会以后就不会开手动了?...
查看>>
mysql启动和关闭外键约束的方法(FOREIGN_KEY_CHECKS)
查看>>
Mysql启动失败解决过程
查看>>