自定义Button Style
来源:互联网 发布:手机行程软件 编辑:程序博客网 时间:2024/05/18 00:49
每个button创建的时候都是用的系统默认的风格,如果不满意系统提供的风格的话,你可以用一个 state list drawable 来替代以前的风格.每个state list drawable 是一个drawable resource. 它定义在xml文件中,并且能改变当前的每个状态的背景图.一旦定义了一个自己设计的xml文件,可以在android:background中使用它.
此xml文件中的格式如下,并且很明显发现,一个xml由一个selector元素,包含N个item元素组成.
<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android" android:constantSize=["true" | "false"] android:dither=["true" | "false"] android:variablePadding=["true" | "false"] > <item android:drawable="@[package:]drawable/drawable_resource" android:state_pressed=["true" | "false"] android:state_focused=["true" | "false"] android:state_hovered=["true" | "false"] android:state_selected=["true" | "false"] android:state_checkable=["true" | "false"] android:state_checked=["true" | "false"] android:state_enabled=["true" | "false"] android:state_activated=["true" | "false"] android:state_window_focused=["true" | "false"] /></selector>下面是sdk中的一个例子
<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/button_pressed" /> <!-- pressed --> <item android:state_focused="true" android:drawable="@drawable/button_focused" /> <!-- focused --> <item android:state_hovered="true" android:drawable="@drawable/button_focused" /> <!-- hovered --> <item android:drawable="@drawable/button_normal" /> <!-- default --></selector>
- 自定义Button Style
- 使用style.xml自定义button效果
- Button Style and Input Style
- css style (input button)
- wpf button ,datagrid style
- wpf button style
- WPF Button Color Style
- Wpf Button Style customized
- 自定义style
- 一只大二狗的Android历程--简单自定义按钮样式(Custom Button Style)
- WPF Button Style 设定WPF BUTTON的 Style
- 自定义button
- 自定义BUTTON!
- 自定义button
- 自定义Button
- 自定义button
- 自定义button
- 自定义Button
- 结合一程序分析Handler,Looper,HandlerThread类 .
- 相电压或线电压
- Android学习笔记技巧之给文本加边框
- oracle 导入数据库脚本后,有些视图或者存储过程没有自动编译的批量解决方式
- Android中Calendar与Date的区别以及消除时区对日期操作影响的方法
- 自定义Button Style
- Android ListView 去除底色、选中色、阴影
- 去掉bat和某些exe的黑窗口
- log4c 的学习
- js 处理实体字符串
- 【SQL分享】根据字符分割字符串的最好的写法【经典】
- Windows Phone开发之String与StringBuilder
- 倒排索引
- 对话框程序的Pediy