安卓开发-图像处理-shape的使用
1.在drawable文件夹下新建 .xml文件
2.各属性介绍:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!--指定圆角弧度-->
<corners android:radius="8dp"></corners>
<!--内部填充-->
<!--<solid android:color="#2BC5B9"></solid>-->
<!--描边-->
<stroke android:color="#2BCA41" android:width="5dp" android:dashWidth="10dp" ></stroke>
<!--尺寸-->
<size android:width="100dp" android:height="40dp"></size>
<!--内边距-->
<padding android:bottom="5dp" android:left="5dp" android:right="5dp" android:top="5sp"> </padding>
<!--渐变色填充-->
<gradient android:startColor="#000" android:centerColor="#0FF" android:endColor="#FF0" android:angle="90" ></gradient>
</shape>
coners: 圆角
>radius 圆角的半径,越小越圆
stroke:边框
>color 边框颜色
>width 边框线条宽度
> dashWidth 边框断续间隔
padding:内边距
gradient:渐变色
>startColor 开始颜色
>centerColor 中间颜色
>endColor 结束颜色
>angle 0表示水平渐变,90表示垂直渐变
size 指定大小
>width 宽度
>height 高度
3.结果展示