Shape Drawable
生活随笔
收集整理的这篇文章主要介绍了
Shape Drawable
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
为什么80%的码农都做不了架构师?>>>
用处:需要一个绘制一个矩形、椭圆、线形、圆形的时候
文件位置:
res/drawable/filename.xml
语法
<?xml version="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将会报错,error inflating class -->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" 形状的宽度,as a dimension value or dimension resource.android:height="integer" 形状的高度 as a dimension value or dimension resource./><!-- 填充 --><solidandroid:color="color" The color to apply to the shape, as a hexadecimal value or color resource./><!-- 描边 --><!-- dashWidth和dashGap属性,只要其中一个设置为0dp,则边框为实现边框 --><strokeandroid:width="integer" 设置边边的宽度 android:color="color" 设置边边的颜色 android:dashWidth="integer" 设置虚线的宽度 android:dashGap="integer" 设置虚线的间隔宽度/> </shape>转载于:https://my.oschina.net/qenter/blog/621623
总结
以上是生活随笔为你收集整理的Shape Drawable的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 如何使用 Java8 实现观察者模式?(
- 下一篇: setTimeOut函数和setInte