Android中Selector的使用
来源:互联网 发布:macbook 下载软件网站 编辑:程序博客网 时间:2024/05/21 12:51
Android中Selector的使用
学习了那么久,一直没有好好总结过selector的用法,现在就来总结一下。首先要创建一个selector,可以在
<?xml version="1.0" encoding="UTF-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/p2_normal" android:state_pressed="false"/> <item android:drawable="@drawable/p2_pressed" android:state_pressed="true"/></selector>
下面是我在layout文件中进行的一个配置
<ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:clickable="true" android:src="@drawable/p2"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="true" android:background="@drawable/p2" />
可以发现,直接进行一个引用就可以了,非常的方便。
在这里,还有一个非常方便的插件,就是通过SelectorChapek工具使用。具体可以参见SelectorChapek工具
这篇博客。第一次写博客,还有很多不懂的地方,全当是一种尝试了。
0 0
- Android中Selector的使用
- Android中selector的使用
- Android中selector的使用
- Android中selector的使用
- Android中selector的使用
- android 中selector的使用
- Android中selector的使用
- Android中selector的使用
- Android中selector的使用
- Android中selector的使用
- Android中Selector的使用
- Android中selector的使用
- android中selector使用
- android中selector使用
- android中selector使用
- Android中关于Selector的使用
- Android中 shape和selector的使用
- android中shape与selector的使用
- 替换空格
- PAT (Basic Level) Practise (中文)1069. 微博转发抽奖(20) 解题报告
- 自定义的三项开关控件
- Hadoop环境----自动分区和挂载磁盘
- 添加nginx为系统服务(service nginx start/stop/restart)
- Android中Selector的使用
- iOS开发之样式多样好用的滑动视图Demo
- 我的Android读书笔记——(1)
- android PinYinIME横屏模式禁止全屏输入 & 调整横屏模式下键盘高度
- 使用jpa注解数据库中的一对一关系
- wget失效
- VS warning C4819
- iOS 同步线程的方式
- 网页qq客服跳转