11通过封装GradientDrawable、StateListDrawable 、LayerDrawable 代替每次都需要创建一个shape.xml的不便,一定程度上也可以减少apk体积,并且使用简单。
22
33## 功能
4- 1.支持shape的绝大部分常用属性。
5- 2.可代替Selector
6- 3.可代替Layer-list
4+ * 不用再写shape.xml文件了!!!
5+ * 链式调用
6+ * 涵盖Shape几乎常用的所有属性,如:TYPE,Radius,Stroke,Solid,Gradient,GradientType,GradientCenter,GradientRadius,size
7+ * 支持Selector
8+ * 支持Layer-list
79
810## How to:
911** Step 1. Add the JitPack repository to your build file**
@@ -21,7 +23,7 @@ Step 2. Add the dependency
2123
2224```
2325dependencies {
24- compile 'com.github.sdfdzx:SupperShape:v1.0.0 '
26+ compile 'com.github.sdfdzx:SupperShape:v1.0.1 '
2527 }
2628```
2729
@@ -31,7 +33,7 @@ dependencies {
3133```
3234ShapeBuilder.create()
3335 .Type(RECTANGLE)
34- .Soild (Color.RED)
36+ .Solid (Color.RED)
3537 .Stroke(5,Color.BLACK)
3638 .build(View);
3739```
@@ -55,13 +57,13 @@ Type(int type)
5557public ShapeBuilder Stroke(int px, int color)
5658public ShapeBuilder Stroke(int px, int color, int dashWidth, int dashGap)
5759```
58- 3.Soild填充属性
60+ 3.Solid填充属性
5961```
6062 /**
6163 *
6264 * @param color -背景颜色
6365 */
64- public ShapeBuilder Soild (int color)
66+ public ShapeBuilder Solid (int color)
6567```
66684.Radius圆角属性
6769```
@@ -150,13 +152,13 @@ public ShapeBuilder Stroke(int px, int color, int dashWidth, int dashGap)
150152```
151153 ShapeBuilder builder1 = ShapeBuilder.create()
152154 .Type(RECTANGLE)
153- .Soild (Color.RED);
155+ .Solid (Color.RED);
154156 ShapeBuilder builder2 = ShapeBuilder.create()
155157 .Type(RECTANGLE)
156- .Soild (Color.RED);
158+ .Solid (Color.RED);
157159
158160 ShapeListBuilder.create(builder1.build())
159- .addShape(builder2.Soild (Color.BLUE).build(), android.R.attr.state_selected)
161+ .addShape(builder2.Solid (Color.BLUE).build(), android.R.attr.state_selected)
160162 .build(findViewById(R.id.tv1));
161163
162164 findViewById(R.id.tv1).setOnClickListener(new View.OnClickListener() {
0 commit comments