Shape Drawable
16lz
2021-01-23
用处:需要一个绘制一个矩形、椭圆、线形、圆形的时候
文件位置:
res/drawable/filename.xml
语法
<?xmlversion="1.0"encoding="utf-8"?><shape<!--矩形,椭圆,直线,环形-->xmlns:android="http://schemas.android.com/apk/res/android"android:shape=["rectangle"|"oval"|"line"|"ring"]><!--圆角--><corners<!--设置四个角的半径-->android:radius="integer"android:topLeftRadius="integer"单独设置左上角半径android:topRightRadius="integer"单独设置右上角半径android:bottomLeftRadius="integer"单独设置左下角半径android:bottomRightRadius="integer"单独设置右下角半径/><!--渐变--><gradientandroid:angle="integer"渐变角度,必须是45的倍数,0也是45倍数android:centerX="integer"相对X轴的渐变位置android:centerY="integer"相对Y轴的渐变位置android:centerColor="integer"渐变的中间颜色android:endColor="color"渐变的结尾颜色<!--半径梯度或是渐变颜色的半径,仅仅当type=linear的时候有用--><!--如果android:type="radial",没有设置android:gradientRadius将会报错,errorinflatingclass-->android:gradientRadius="integer"android:startColor="color"渐变的开始颜色android:type=["linear"|"radial"|"sweep"]渐变类型,线性渐变|径向渐变|扫描或是梯度渐变android:useLevel=["true"|"false"]/>当做是LevelListDrawable使用时值为true,否则为false<!--间隔--><!--设置四个方向上的间隔--><paddingandroid:left="integer"android:top="integer"android:right="integer"android:bottom="integer"/><sizeandroid:width="integer"形状的宽度,asadimensionvalueordimensionresource.android:height="integer"形状的高度asadimensionvalueordimensionresource./><!--填充--><solidandroid:color="color"Thecolortoapplytotheshape,asahexadecimalvalueorcolorresource./><!--描边--><!--dashWidth和dashGap属性,只要其中一个设置为0dp,则边框为实现边框--><strokeandroid:width="integer"设置边边的宽度android:color="color"设置边边的颜色android:dashWidth="integer"设置虚线的宽度android:dashGap="integer"设置虚线的间隔宽度/></shape>
更多相关文章
- android中的颜色值
- Android 修改EditText光标颜色
- android位图颜色模式的问题
- android 各种控件颜色值的设置(使用Drawable,Color)
- android中修改tablayout中的字体大小和颜色
- android textview系统默认的颜色值是多少