<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 填充色 -->
<solid android:color="#ffffff" />填充色使用 gradient时这个就无效了
<!-- 边框 -->
<stroke
android:width="1dp"//边框
android:color="#333333" />边框颜色
<!-- 圆角 -->
<corners android:radius="10dp"//四角的圆角设置
android:bottomLeftRadius="10dp"//左下角的圆角设置
android:bottomRightRadius="10dp"//右下角的圆角设置
android:topRightRadius="10dp"//右上角的圆角设置
android:topLeftRadius="10dp"/>//左上角的圆角设置
<!-- 渐变色 -->
<gradient android:angle="45"//渐变色角度:只能填45 90 180 360 其他的无效
android:endColor="" //结束颜色
android:startColor=""/>//开始颜色
</shape>
不要直接全复制过去,自己一个一个的试一下效果,根据自己的需要自己定义,常用的就这几个,自己学着用吧。调用方法在xml里设置成Background就行了。
调用方法:android:background="@drawable/shape_top_white"
<Button
android:id="@+id/btn_pop_camera"
android:layout_width="match_parent"
android:layout_height="@dimen/dm080"
android:layout_marginLeft="@dimen/dm050"
android:layout_marginRight="@dimen/dm050"
android:background="@drawable/shape_top_white"
android:gravity="center"
android:text="拍照"
android:textSize="@dimen/dm030" />