android 自定义button
来源:互联网 发布:telnet 80端口不通 编辑:程序博客网 时间:2024/06/11 08:28
自定义button 我们先看一下系统button 是 怎么工作的
<selector xmlns:android="http://schemas.android.com/apk/res/android">
///获得焦点
<item android:state_window_focused="false" android:state_enabled="true"
android:drawable="@drawable/btn_default_normal" />
<item android:state_window_focused="false" android:state_enabled="false"
android:drawable="@drawable/btn_default_normal_disable" />
<item android:state_pressed="true"
android:drawable="@drawable/btn_default_pressed" />
<item android:state_focused="true" android:state_enabled="true"
android:drawable="@drawable/btn_default_selected" />
<item android:state_enabled="true"
android:drawable="@drawable/btn_default_normal" />
<item android:state_focused="true"
android:drawable="@drawable/btn_default_normal_disable_focused" />
<item
android:drawable="@drawable/btn_default_normal_disable" />
</selector>
我们自定义按钮时候 直接复制上面xml文件就好了在res 创建一个drawable 文件夹
在文件夹下面 xml 文件
<?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/main_clean_icon_pressed" /> <!-- pressed -->
<item android:state_focused="true"
android:drawable="@drawable/main_clean_icon_pressed" /> <!-- focused -->
<item android:drawable="@drawable/main_clean_icon" /> <!-- default -->
</selector><?xml version="1.0" encoding="utf-8"?>
在控件中使用background 属性引用上面一个xml文件就好了
- Android自定义Button组件
- android自定义button样式
- android之自定义button
- android 自定义button shape
- android 自定义BUtton
- Android自定义Button按钮
- android自定义button样式
- android自定义button样式
- android 自定义button样式
- Android:自定义Button
- android 自定义button
- android 自定义 button样式
- Android 自定义Action Button
- Android自定义Button
- android自定义button样式
- Android-自定义反色圆角Button
- android自定义Button
- Android button自定义显示
- java网络编程—读取html存储到文件中
- Sqrt(x)
- C++实现将十进制数转换为小于等于九的任意进制
- 在32位处理器上指针的长度为4字节,为什么是4字节,而不是16字节,或者32字节
- 查找重复数字2
- android 自定义button
- 把二元查找树转变成排序的双向链表
- kmp算法的实现
- hdu2023求品均成绩
- CodeBlock 快捷键大全
- strcpy和memcpy的区别
- linux中pid gid tgid tid的区别和联系
- leetcode 之 Jump Game
- 常见编程题