Android - 视图点击效果
来源:互联网 发布:ubuntu的samba服务器 编辑:程序博客网 时间:2024/06/01 09:18
视图点击修改背景.
按压时更换背景, 抬起时恢复背景, 依赖state_pressed.
登陆成功后禁止点击, 并更换背景, 依赖state_enabled.
<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@android:color/transparent" android:state_pressed="true"/> <item android:drawable="@android:color/transparent" android:state_enabled="false"/> <item android:drawable="@color/white"/></selector>
系统默认点击的闪烁效果, 版本5.0以上支持. android:background="?android:attr/selectableItemBackground"
Code
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:exitFadeDuration="@android:integer/config_mediumAnimTime"> <item android:drawable="@color/transparent" android:state_window_focused="false"/> <!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. --> <item android:drawable="@drawable/list_selector_background_disabled" android:state_enabled="false" android:state_focused="true" android:state_pressed="true"/> <item android:drawable="@drawable/list_selector_background_disabled" android:state_enabled="false" android:state_focused="true"/> <item android:drawable="@drawable/list_selector_background_transition" android:state_focused="true" android:state_pressed="true"/> <item android:drawable="@drawable/list_selector_background_transition" android:state_focused="false" android:state_pressed="true"/> <item android:drawable="@drawable/list_selector_background_focused" android:state_focused="true"/> <item android:drawable="@color/transparent"/></selector>
1 0
- Android - 视图点击效果
- Android 视图切换效果
- 布局视图实现点击波纹效果
- android实现点击效果
- Android:TextView点击效果
- Android TextView点击效果
- Android点击效果
- Android Image点击效果
- android点击波纹效果
- 【Android】Android 水波点击效果
- Android XML视图 平分效果
- android自定义TabHost点击效果
- Android Spinner 点击没效果
- Android ListView更换点击效果
- Android自定义Button点击效果
- Android 点击事情 颜色效果
- Android Radiobutton 文字点击效果
- android自定义button点击效果
- (转)数据库采用B+树而不是B-树 b树的原因
- poj 2228 循环dp(睡觉最大值)
- 选项卡制作
- NHibernate从入门到精通系列(9)——一对多关联映射
- 黑马程序员学习(六) 内部类和异常机制
- Android - 视图点击效果
- Fetching https://dl-ssl.google.com/***************
- 定义属性时NSArray,NSString,NSDictionary为何要用copy
- srs之hls热备
- 合并两个排序的链表
- 微信支付的一点操作经验
- 15_09_15 ( NullPointerException ) 空指针异常
- DrawText()
- 实现Singleton模式