Android自定义按钮状态背景
来源:互联网 发布:java开源商城 编辑:程序博客网 时间:2024/05/01 00:55
如果你觉得Android自带的按钮默认、按下时样式太low,可以尝试自定义按钮状态背景:
首先把我自定义的按钮状态背景图贴上来:
默认时:
按下后:
有没有很小清新呐~~~
自定义按钮状态步骤如下:
(1)在res文件夹下新建个drawable文件夹
(2)把要设置的按钮默认背景图片与按下时背景图片放入drawable文件夹中
(3)在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/item_bg_pressed"/> <!-- 按下的效果 -->
<item android:state_focused="true"
android:drawable="@drawable/item_bg_pressed" /> <!-- 有焦点时的效果 -->
<item android:drawable="@drawable/item_bg_normal"/> <!-- 默认效果 -->
</selector>
(4)在布局文件的<Button >标签中增加android:background=”@drawable/XML文件名”
比比看你做的有没有比系统的美腻?!
0 0
- Android自定义按钮状态背景
- Android之自定义背景按钮、自定义形状按钮
- Android之自定义背景按钮、自定义形状按钮
- 手机卫士学习13-自定义按钮状态背景
- ImageButton背景透明(没有按钮框)以及自定义不同状态样式,自定义背景
- android按钮状态自定义样式表
- UI--Android中的状态切换按钮自定义
- UI--Android中的状态切换按钮自定义
- android自定义AlertDialog背景、背景边框消除、自定义背景按钮监听事件
- Button自定义状态背景
- 设置Button按钮状态背景
- android背景选择器selector用法、自定义Button按钮样式..........
- android背景选择器selector用法、自定义Button按钮样式
- 状态选择器(自定义按钮)
- UISearchBar 自定义,加背景,取消按钮背景
- UISearchBar 自定义,加背景,取消按钮背景
- UINavigationBar自定义背景以及按钮
- UINavigationBar自定义背景以及按钮
- ROS 摄像头矫正 camera_calibration
- 输出100到200之间的素数
- Jquery下的Ajax调试方法
- php缓存原理
- Myeclipse 2015 stable 1.0 完美破解方法
- Android自定义按钮状态背景
- 烟大ACM新秀赛 C填写乘法算式
- NSArray用法简记
- minidwep-gtk.sh的分析基础
- 设计模式之单例模式
- C#中读取存储过程中临时表中的数据的写法
- Memcache知识点梳理
- JVM Specification Reading 1
- 基于Linux Rational Performance Tester自动化测试研究