android style设置控件样式
2014-06-03 22:52
597 查看
以下是要使用的四个文件
normal_default.xml
normal_pressed.xml
normal_button.xml,这个是设置button不同状态下的样子
在style.xml中加入下面代码
normal_default.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <corners android:radius="5dp"></corners> <solid android:color="#ff494949"></solid> </shape>
normal_pressed.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#ff2f2f2f"/> <corners android:radius="5dp"/> </shape>
normal_button.xml,这个是设置button不同状态下的样子
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/normal_pressed" android:state_pressed="true"/> <item android:drawable="@drawable/normal_default"/> </selector>
在style.xml中加入下面代码
<style name="normal_button_style"> <item name="android:background">@drawable/normal_button</item> <item name="android:textColor">#ff18d2fc</item> <item name="android:padding">5dp</item> </style>
相关文章推荐
- android如何设置控件的样式
- Flex中通过设置fontFamily和labelStyleName样式在HSlider控件中使用嵌入字体的例子
- Flex中如何通过tabStyleName, tabWidth和textAlign样式,设置TabBar控件内文本对齐方式
- android 控件 getBackground().setAlpha设置透明值,影响其他页面样式问题
- WPF后台设置xaml控件的样式System.Windows.Style
- android控件文本样式的设置方法
- android 样式style的设置
- 注意Android里TextView控件的一个小坑,用android:theme来设置样式时动态载入的layout会丢失该样式
- android numberpicker控件的布局在没有标题情况下设置3.0新样式方法
- android 中如何设置控件的字体和背景样式
- Android控件动态设置style的问题
- Android style(样式)和theme(主题)设置
- Android: 设定控件样式(style)
- android的Spinner控件的自定义样式设置以及ArrayAdapter的使用
- Flex中通过设置textAlign和headerStyleName样式设置DateChooser控件头部年月文本对齐方式的例子
- android style(样式)和theme(主题)设置
- android如何设置控件的样式
- Android学习篇章16-Style控件样式的使用
- android UI学习 -- 设置界面的布局(包括style的使用,selector的使用,Checkbox自定义样式,菜单项的样式)
- android中控件的style中主题样式定义