状态选择器及Button形状
来源:互联网 发布:购买域名的网站 编辑:程序博客网 时间:2024/06/04 19:12
一: 需要实现状态选择器:1.在res下创建文件(Driectory),命名自定义
2.在自己创建的文件下再创建一个XML文件在里面定义
<selector xmlns:android="http://schemas.android.com/apk/res/android"><item android:color="#fff" android:state_pressed="true"/> <item android:color="#fff" android:state_focused="true"/> <item android:color="@color/colorAccent"/></selector>
其中 第一个item 表示按下时的颜色
第二个item 表示获取焦点
第三个item 表示默认颜色
<Button android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/button" android:textColor="@color/button"/>这里显示的是button按钮按下时改变颜色
二:给Button按钮设置形状
1.在drawable下创建文件shape
<shape xmlns:android="http://schemas.android.com/apk/res/android"><stroke android:color="#000" android:width="2dp"/><corners android:radius="360dip"/><gradient android:type="linear" android:endColor="#1f2" android:startColor="#16f"/><padding android:bottom="10dp" android:right="10dp" android:top="10dp" android:left="10dp"/></shape>在布局中引用
android:background="@drawable/shape"
这样button按钮就变成一个椭圆形
阅读全文
0 0
- 状态选择器及Button形状
- Button按钮状态选择器
- Button 样式及selector选择器
- 设置Button的字体颜色状态选择器
- android select选择器 checkbox改外观,button按下状态
- button 状态
- Android自定义Button/ImageButton形状
- iOS自定义形状的Button
- 状态选择器
- 状态选择器
- 状态选择器
- 状态选择器
- android selector 背景选择器的使用, button (未点击,点击,选中保持状态)效果实现
- 一个button设置EditText状态可编辑及不可编辑
- Android之Button文本及背景根据状态设置
- 为Button设置选择器
- Button背景颜色选择器。
- 自定义Button形状(圆形、椭圆)
- 文件对话框CFileDialog类:打开和保存
- 中国剩余定理
- 微信公众号开发--接收与回复消息(Java)
- 前端跨域的问题
- cacheUtils
- 状态选择器及Button形状
- android 动画详解
- angularjs指令中的compile与link函数详解
- 关于字典表与实例表的思考
- vue指令大全
- Leetcode84. Largest Rectangle in Histogram.
- Master: Error: JAVA_HOME is not set and could not be found.
- 事物的五种隔离级别
- xxxx