Android自定义按钮样式
2012-09-27 22:19
375 查看
使得按钮在不同的状态有不同的背景图片是本篇的主要类容
在res/drawable下新建一个buttonstyle.xml文件,这个文件用于描述按钮的样式
还有很多的样式如下图
在布局文件中添加一个Button,使用buttonstyle.xml
这样就完成了Button的样式。
在res/drawable下新建一个buttonstyle.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/btn_p"/> <item android:state_pressed="false" android:drawable="@drawable/btn_n"/> </selector>
还有很多的样式如下图
在布局文件中添加一个Button,使用buttonstyle.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/buttonstyle" /> </LinearLayout>
这样就完成了Button的样式。
相关文章推荐
- Android自定义Button按钮显示样式
- 一只大二狗的Android历程--自定义按钮样式(补充)
- Android 自定义Notification通知样式并设置按钮监听.
- android自定义按钮控件样式 (转)
- Android 自定义Button按钮显示样式(正常、按下、获取焦点)
- android 自定义多功能按钮(转盘样式)
- Android 自定义Button按钮显示样式(正常、按下、获取焦点)
- Android自定义FlowLayout,可带固定按钮,可自定义样式、选择数量
- Android自定义Button按钮显示样式
- Android自定义Button按钮显示样式
- Android自定义Button按钮显示样式
- Android自定义Button按钮显示样式
- Android 自定义Button按钮显示样式(正常、按下、获取焦点)
- ---转Android 自定义Button按钮显示样式
- Android自定义Button按钮显示样式
- Android自定义Button按钮显示样式
- android背景选择器selector用法、自定义Button按钮样式..........
- Android自定义Button按钮显示样式
- 一只大二狗的Android历程--简单自定义按钮样式(Custom Button Style)
- Android自定义样式(风格)的dialog对话框(点击其中的按钮跳转到下一个页面)