自定义样式View(二)--自定义Button
来源:互联网 发布:消费金融用户数据画像 编辑:程序博客网 时间:2024/05/23 00:09
Android中自带的 Button 样式比较丑,为了美化 Button 可使用一下方法。
实现效果如下:
1.自定义Button 背景选择器
2.自定义Buton 素材
3.自定义Button 背景
欢迎关注微信公众号:程序员Android
公众号ID:ProgramAndroid
获取更多信息
我们不是牛逼的程序员,我们只是程序开发中的垫脚石。
我们不发送红包,我们只是红包的搬运工。
1.自定义Button 背景选择器
自定义Button 背景选择器 custom_btn_selector.xml
<?xml version="1.0" encoding="UTF-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- 按下去的背景颜色显示效果 --> <item android:drawable="@drawable/btn_press" android:state_pressed="true"/> <!-- 获取焦点时背景颜色显示效果 --> <item android:drawable="@drawable/btn_press" android:state_focused="true"/> <!-- 没有任何状态下的背景颜色 --> <item android:drawable="@drawable/btn_normal"/></selector>
2.自定义Buton 素材
3.自定义Button 背景
<Button android:layout_width="match_parent" android:layout_height="60dp" android:layout_margin="10dp" android:background="@drawable/custom_btn_selector" android:text="自定义Button选择器" />
至此,就可以完全按自己风格定义Button 背景。
欢迎关注微信公众号:程序员Android
公众号ID:ProgramAndroid
获取更多信息
我们不是牛逼的程序员,我们只是程序开发中的垫脚石。
我们不发送红包,我们只是红包的搬运工。
点击阅读原文,获取更多福利
阅读全文
0 0
- 自定义样式View(二)--自定义Button
- 【android自定义控件】button样式自定义<二>
- 自定义Dialog(自定义button样式)
- 自定义Button样式
- android自定义button样式
- 自定义button按钮样式
- Button按钮自定义样式
- 自定义Button样式
- android自定义button样式
- 关于button自定义样式
- android自定义button样式
- android 自定义button样式
- android 自定义 button样式
- android自定义button样式
- Wpf Button自定义样式
- 自定义button的样式
- 自定义View和自定义Button
- 自定义view,之自定义button
- 单行左右两边的对称布局的更好的实现方式
- Idea 报错 <statement> or delimiter expected
- 文章标题
- DirectShow在VS2015中PVOID64问题和配置问题
- 实验二间接寻址
- 自定义样式View(二)--自定义Button
- spring cloud分布式云架构
- 火热的生成对抗网络(GAN),你究竟好在哪里
- 数据表的基本操作
- Heron:Twitter的新一代流处理引擎
- 如何在17天之内收获70份工作面试?
- 10倍效率的开发人员都擅长这三件事,你也可以
- 如何在开源项目中学到更多?
- 共享资源