selector StateListDrawable
来源:互联网 发布:mac excel sover 编辑:程序博客网 时间:2024/05/22 12:24
- StateListDrawable对应 selector
- selector标签使用语法
- Item标签使用语法
StateListDrawable对应< selector>
< selector> 表示Drawable集合,每个Drawable对应View的一种状态,这样系统就会根据View的状态来选择合适的Drawable。
<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android" android:constantSize="true" android:dither="true" android:variablePadding="true"> <item android:drawable="@drawable/ic_launcher" android:state_activated="true" android:state_checkable="true" android:state_checked="true" android:state_enabled="true" android:state_focused="true" android:state_hovered="true" android:state_pressed="true" android:state_selected="true" android:state_window_focused="true" /></selector>
< selector>标签使用语法
android:constantSize=”true” StateListDrawable 的固有大小是否不随其状态改变而改变的,因为状态的改变导致StateListDrawable切换到具体的Drawable,而不同的Drawable具有不同的大小。默认选项为false。
true 表示StateListDrawable的固有大小保持不变,这时它的固有大小是内部所有Drawable的固有大小的最大值
false 表示StateListDrawable的固有大小会随着Drawable的改变而改变。
android:dither=”true” 是否开启抖动效果,这个在BitmapDrawable中也有使用,开启此选项可以在低质量的屏幕上任然获得较好的显示效果,默认选项为true。
android:variablePadding=”true” 表示padding是否随着状态改变而改变。默认false,不建议开启。
true 表示padding随着状态的改变而改变
false 表示StateListDrawable的padding是内部所有Drawable的padding的最大值。
< Item>标签使用语法
- android:state_pressed 表示按下状态,比如Button按下没有松开的状态。
- android:state_focused 表示View是否获取焦点
- android:state_selected 表示用户是否选择了View
- android:state_checked 表示用户是否选中了View,一般用于CheckBox这类选中和非选中状态之间切换的View。
- android:state_enabled 表示View当前处于可用状态
注意: 系统会根据View的当前状态从 selector 中选择对应的item,每个item对应一个具体的Drawable,系统按照从上到下的顺序查找,直到查找到第一条匹配的item。默认的item应该放在最后,应为默认的item不附带任何状态。
- selector StateListDrawable
- 总结StateListDrawable(selector)用法
- StateListDrawable与<selector>的各种状态
- android 代码编写selector--StateListDrawable使用
- StateListDrawable
- StateListDrawable
- StateListDrawable
- 简单记录——android selector对应的java实现:StateListDrawable
- java代码中实现android背景选择的selector-StateListDrawable的应用
- java代码中实现android背景选择的selector-StateListDrawable的应用
- java代码中实现android背景选择的selector-StateListDrawable的应用
- android StateListDrawable
- StateListDrawable、ColorStateList
- StateListDrawable资源
- StateListDrawable资源
- Android StateListDrawable
- StateListDrawable用法
- StateListDrawable、ColorStateList
- 重写和强制转换再调用能编译但不能运行
- 关于构造方法的那些事儿
- R语言函数union、setdiff、insect
- Jquery prop 和 attr的区别
- 如何应对没有需求的测试
- selector StateListDrawable
- 所涉及到的几种 sklearn 的二值化编码函数:OneHotEncoder(), LabelEncoder(), LabelBinarizer(), MultiLabelBinarizer()
- Mybatis之foreach
- Asp.Net: 从Php+Mysql到Asp.Net+SqlServer
- 远程服务器终端访问URL或者API
- Android-友盟社会化分享库&自定义分享
- JProfiler 调试优化java程序笔记
- 博览网C++课程 第四周
- Gson解析json数据