安卓button点击变色加圆角边框实现。
2015-12-09 21:22
253 查看
1,
这种方法表示过时,官方不推荐使用,但还是可以使用的方法。
***************************************************************
首先,layout布局:
shape_bt_login_pressed.xml:
shape_bt_login_normal.xml:
这种方法表示过时,官方不推荐使用,但还是可以使用的方法。
***************************************************************
首先,layout布局:
<Button android:layout_width="match_parent" android:layout_height="40dp" android:layout_margin="30dp" android:background="@drawable/btn_login_selector" android:gravity="center" android:text="登录" android:textColor="#ffffff" android:textSize="16sp" />然后,
btn_login_selector.xml
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/shape_bt_login_pressed" android:state_pressed="true"/> <item android:drawable="@drawable/shape_bt_login_normal" android:state_pressed="false"/> </selector>
shape_bt_login_pressed.xml:
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <corners android:radius="3dp"/> <solid android:color="#DB4537"/> </shape>
shape_bt_login_normal.xml:
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <corners android:radius="3dp"/> <solid android:color="#f36360"/> </shape>。
相关文章推荐
- 有限状态机
- 关于基于复杂网络的数据挖掘的学习笔记
- spark连接mysql数据库(python语言)
- Stream API:提取子流和组合流
- 解析 this.initialize.apply(this, arguments)
- struts2拦截器
- 背包问题
- 循环链表例题
- Android每日一练之ObjectAnimator
- 有关推挽输出、开漏输出、复用开漏输出、复用推挽输出以及上拉输入、下拉输入、浮空输入、模拟输入区别
- 今天开始使用unity 5.3 进行学习编程
- Swift中编写单例的正确方式
- 调整数组顺序使奇数位于偶数前面
- tomcat如何配置环境变量
- android混合开发,webview的java与js互操作
- 关于 Android 中的 getResource()
- java 聚合关系
- linux ping localhost不通,127.0.0.1能通
- android - Dialogs(2)
- [leetcode]Pascal's Triangle II