Stbdroid之StateListDrawable
来源:互联网 发布:unity3d 跟随目标移动 编辑:程序博客网 时间:2024/05/16 10:49
StateListDrawable对象的XML文件的根元素是<selector .../>,里面可以包含许多的<item.../>,并可以根据需要设置相关的属性。
是否激活状态android:state_checkable
是否可勾选android:state_checked
是否已勾选android:state_enabled
是否可用状态android:state_first
是否是开始状态android:state_focused
是否已获得焦点android:state_last
是否在结束状态android:state_middle
是否在中间android:state_pressed
是否已按下android:state_selected
是否已选中android:state_window_focused
是否窗口得到焦点
下面是一个简单的例子:
按键在得失焦点时的字体颜色和背景的变化
text在得失焦点时的颜色变化
<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_focused="true" android:color="@android:color/holo_red_light"/> <item android:state_focused="false" android:color="@android:color/black"/></selector>
background在得失焦点时的颜色变化<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_focused="true" android:drawable="@drawable/ic_launcher" /> <item android:state_focused="false" android:drawable="@drawable/ic_icon" /></selector>
<Button android:layout_width="100dp" android:layout_height="wrap_content" android:background="@drawable/bg_style" android:text="Button One" android:textSize="32sp" android:textColor="@drawable/text_color_style" /> <Button android:layout_marginLeft="20dp" android:layout_width="100dp" android:layout_height="wrap_content" android:background="@drawable/bg_style" android:text="Button Two" android:textSize="32sp" android:textColor="@drawable/text_color_style" />
- Stbdroid之StateListDrawable
- Stbdroid之Fragment
- Stbdroid之ShapeDrawable
- Stbdroid之HorizontalScrollView
- Stbdroid之GridView+选中动画放大
- 资源文件之StateListDrawable
- Drawable学习之-----StateListDrawable
- StateListDrawable
- StateListDrawable
- StateListDrawable
- Stbdroid之代码动态创建和删除小部件
- 初学Android,使用Drawable资源之使用StateListDrawable资源(十三)
- Android开发艺术探索<Drawable系列之四StateListDrawable >
- android StateListDrawable
- StateListDrawable、ColorStateList
- StateListDrawable资源
- StateListDrawable资源
- Android StateListDrawable
- Eclipse reports rendering library more recent than ADT plug-in.Please update ADT plug-in
- Linux单用户模式(可以改root密码&++)
- IOS 几个常用的循环
- FreeMarker教程
- Xen:xen安装
- Stbdroid之StateListDrawable
- 各种系统架构图及其简介(原创+收集)
- Android裁剪图片为圆形图片
- showModalDialog打开的页面需要跳转或刷新
- hdu oj 2007
- CocoStudio
- JDK自带的native2ascii工具完全揭密
- 两张图看懂GDT、GDTR、LDT、LDTR的关系
- 为什么js是弱类型,动态类型