android的selector背景选择器(Button篇)
来源:互联网 发布:合肥淘宝打包员招聘 编辑:程序博客网 时间:2024/05/17 22:30
首先android的selector是在drawable/xxx.xml中配置的。
步骤一:res/layout/main.xml文件
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <Button android:id="@+id/btn_add_accoutn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/add_account_d" android:layout_gravity="right" android:layout_marginTop="10dip" android:layout_marginRight="10dip" /> </LinearLayout>
步骤二:res/drawable/add_account_d.xml文件
<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:state_enabled="true" android:state_pressed="false" android:drawable="@drawable/add_account_n" /> <item android:state_enabled="true" android:state_pressed="true" android:drawable="@drawable/add_account_p" /> <item android:state_enabled="true" android:state_checked="true" android:drawable="@drawable/add_account_p" /> <item android:drawable="@drawable/add_account_n" /></selector>
步骤三:在activity里加载main.xml文件即可实现效果了。
0 0
- android的selector背景选择器(Button篇)
- Android的selector,Button按钮背景选择器
- android的selector,背景选择器
- android的selector,背景选择器
- Android的selector,背景选择器
- Android 的 selector--背景选择器
- Android的selector,背景选择器
- Android的selector,背景选择器
- Android的selector,背景选择器
- android的selector,背景选择器
- android的selector,背景选择器
- android的selector,背景选择器
- android的selector背景选择器
- android的selector背景选择器
- Android的selector,背景选择器
- android的selector,背景选择器
- android的selector,背景选择器
- android的selector,背景选择器
- ABBYY FineReader Mac是怎么导入图像的
- 使用Mecanim实现连击(转载)+另外的方法
- Linux下的几种文件拷贝方式效率对比
- C++ debugger package is missing or incompatible - do you want to fix it?
- 重载overlord与重写override的区别
- android的selector背景选择器(Button篇)
- CMD命令详解——目录类命令
- 高度自适应的Listview
- 数据结构之哈希函数
- Spring - beans的xmlns
- 【果果程序人生】PHP成长之路-PHP基础
- excel批量将长日期转短日期
- Linux 安装jdk1.8
- hdu2152Fruit