个人学习笔记!
最近项目组很忙,经常加班,学习变得缓慢,看来决心不够。
简单的圆角按钮(引入样式与主题的门栏),步骤很简单:
①,新建一个XML文件,资源类型选择DRAWABLE ,根目录选择shape ,定义好名称,保存(这一步开始有点纠结,为什么不能再定义按钮属性的时候直接定义呢 。呵呵)。
如下为新增的一个样式XML,名称为 stype_button_shape.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<corners android:radius="10dip"></corners> <!-- 圆角 -->
<solid android:color="#008b8b" /> <!-- 填充颜色 -->
<!-- <padding 其他的一些按钮属性
android:bottom="10dip"
android:top="10dip" /> -->
</shape>
②,使用样式:
<Button
android:background="@drawable/stype_button_shape"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/touch"
android:id="@+id/touch_any"
/>
③,运行程序,效果图像: