类android.graphics.drawable.shapes.RoundRectShape源码实例Demo

下面列出了怎么用android.graphics.drawable.shapes.RoundRectShape的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: android-round-textview   文件: DrawableHelper.java
public static Drawable getCornerDrawable(float topLeft,
                                         float topRight,
                                         float bottomLeft,
                                         float bottomRight,
                                          @ColorInt int color) {

    float[] outerR = new float[8];
    outerR[0] = topLeft;
    outerR[1] = topLeft;
    outerR[2] = topRight;
    outerR[3] = topRight;
    outerR[4] = bottomRight;
    outerR[5] = bottomRight;
    outerR[6] = bottomLeft;
    outerR[7] = bottomLeft;

    ShapeDrawable drawable = new ShapeDrawable();
    drawable.setShape(new RoundRectShape(outerR, null, null));
    drawable.getPaint().setColor(color);

    return drawable;
}
 
源代码2 项目: FloatingActionButton   文件: Label.java
private Drawable createRectDrawable(int color) {
    RoundRectShape shape = new RoundRectShape(
            new float[]{
                    mCornerRadius,
                    mCornerRadius,
                    mCornerRadius,
                    mCornerRadius,
                    mCornerRadius,
                    mCornerRadius,
                    mCornerRadius,
                    mCornerRadius
            },
            null,
            null);
    ShapeDrawable shapeDrawable = new ShapeDrawable(shape);
    shapeDrawable.getPaint().setColor(color);
    return shapeDrawable;
}
 
源代码3 项目: Leanplum-Android-SDK   文件: BitmapUtil.java
private static Drawable getBackground(int normalStateColor,
    int pressedStateColor) {
  StateListDrawable background = new StateListDrawable();
  int c = SizeUtil.dp10;
  float[] r = new float[] {c, c, c, c, c, c, c, c};
  RoundRectShape rr = new RoundRectShape(r, null, null);
  ShapeDrawable cd = new ShapeDrawable();
  cd.setShape(rr);
  cd.getPaint().setColor(pressedStateColor);
  background.addState(new int[] {android.R.attr.state_pressed,
      android.R.attr.state_focused}, cd);
  background.addState(new int[] {-android.R.attr.state_pressed,
      android.R.attr.state_focused}, cd);
  background.addState(new int[] {android.R.attr.state_pressed,
      -android.R.attr.state_focused}, cd);
  ShapeDrawable cd1 = new ShapeDrawable();
  cd1.setShape(rr);
  cd1.getPaint().setColor(normalStateColor);
  background.addState(new int[] {-android.R.attr.state_pressed,
      -android.R.attr.state_focused}, cd1);
  return background;
}
 
源代码4 项目: ShareBox   文件: Label.java
private Drawable createRectDrawable(int color) {
    RoundRectShape shape = new RoundRectShape(
            new float[]{
                    mCornerRadius,
                    mCornerRadius,
                    mCornerRadius,
                    mCornerRadius,
                    mCornerRadius,
                    mCornerRadius,
                    mCornerRadius,
                    mCornerRadius
            },
            null,
            null);
    ShapeDrawable shapeDrawable = new ShapeDrawable(shape);
    shapeDrawable.getPaint().setColor(color);
    return shapeDrawable;
}
 
源代码5 项目: iGap-Android   文件: Utils.java
public static void setShadow(View view, Drawable sd) {
    RoundRectShape rss = new RoundRectShape(new float[]{12f, 12f, 12f,
            12f, 12f, 12f, 12f, 12f}, null, null);
    ShapeDrawable sds = new ShapeDrawable(rss);
    sds.setShaderFactory(new ShapeDrawable.ShaderFactory() {

        @Override
        public Shader resize(int width, int height) {
            LinearGradient lg = new LinearGradient(0, 0, 0, height,
                    new int[]{Color.parseColor("#e5e5e5"),
                            Color.parseColor("#e5e5e5"),
                            Color.parseColor("#e5e5e5"),
                            Color.parseColor("#e5e5e5")}, new float[]{0,
                    0.50f, 0.50f, 1}, Shader.TileMode.REPEAT);
            return lg;
        }
    });

    LayerDrawable ld = new LayerDrawable(new Drawable[]{sds, sd});
    ld.setLayerInset(0, 5, 5, 0, 0); // inset the shadow so it doesn't start right at the left/top
    ld.setLayerInset(1, 0, 0, 5, 5); // inset the top drawable so we can leave a bit of space for the shadow to use

    view.setBackgroundDrawable(ld);
}
 
源代码6 项目: talk-android   文件: ThemeButton.java
public void setThemeBackground(int color, int colorPressed) {
    int radius = DensityUtil.dip2px(getContext(), 2);
    float[] radii = new float[]{radius, radius, radius, radius, radius, radius, radius, radius};

    StateListDrawable states = new StateListDrawable();

    RoundRectShape disableShape = new RoundRectShape(radii, null, null);
    ShapeDrawable disableDrawable = new ShapeDrawable(disableShape);
    disableDrawable.getPaint().setColor(getResources().getColor(R.color.material_grey_300));
    states.addState(new int[]{-android.R.attr.state_enabled}, disableDrawable);

    RoundRectShape pressedShape = new RoundRectShape(radii, null, null);
    ShapeDrawable pressedDrawable = new ShapeDrawable(pressedShape);
    pressedDrawable.getPaint().setColor(colorPressed);
    states.addState(new int[]{android.R.attr.state_pressed}, pressedDrawable);

    RoundRectShape normalShape = new RoundRectShape(radii, null, null);
    ShapeDrawable normalDrawable = new ShapeDrawable(normalShape);
    normalDrawable.getPaint().setColor(color);
    states.addState(new int[]{-android.R.attr.state_pressed}, normalDrawable);

    setBackgroundDrawable(states);
}
 
源代码7 项目: MiBandDecompiled   文件: BadgeView.java
private ShapeDrawable a()
{
    int i1 = a(8);
    float af[] = new float[8];
    af[0] = i1;
    af[1] = i1;
    af[2] = i1;
    af[3] = i1;
    af[4] = i1;
    af[5] = i1;
    af[6] = i1;
    af[7] = i1;
    ShapeDrawable shapedrawable = new ShapeDrawable(new RoundRectShape(af, null, null));
    shapedrawable.getPaint().setColor(n);
    return shapedrawable;
}
 
void setCornerRadius(View view, int radius, int color) {
    radius = _DP(radius);
    int borderWidth = 0;// 加边框后会出现空心圆角矩形的效果,所以设置为0
    float[] outerRadius = new float[8];
    float[] innerRadius = new float[8];
    for (int i = 0; i < 8; i++) {
        outerRadius[i] = radius + borderWidth;
        innerRadius[i] = radius;
    }
    ShapeDrawable shapeDrawable = // 创建图形drawable
            new ShapeDrawable(
                    // 创建圆角矩形
                    new RoundRectShape(outerRadius,
                            new RectF(borderWidth, borderWidth, borderWidth, borderWidth),
                            innerRadius));
    shapeDrawable.getPaint().setColor(color);// 使用指定的颜色绘制,即背景颜色
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        // 高版本SDK使用新的API
        view.setBackground(shapeDrawable);
    } else {
        view.setBackgroundDrawable(shapeDrawable);
    }
}
 
源代码9 项目: clear-todolist   文件: Label.java
private Drawable createRectDrawable(int color) {
    RoundRectShape shape = new RoundRectShape(
            new float[]{
                    mCornerRadius,
                    mCornerRadius,
                    mCornerRadius,
                    mCornerRadius,
                    mCornerRadius,
                    mCornerRadius,
                    mCornerRadius,
                    mCornerRadius
            },
            null,
            null);
    ShapeDrawable shapeDrawable = new ShapeDrawable(shape);
    shapeDrawable.getPaint().setColor(color);
    return shapeDrawable;
}
 
源代码10 项目: SublimePicker   文件: SUtils.java
private static Drawable createButtonShape(Context context, int color) {
    // Translation of Lollipop's xml button-bg definition to Java
    int paddingH = context.getResources()
            .getDimensionPixelSize(R.dimen.button_padding_horizontal_material);
    int paddingV = context.getResources()
            .getDimensionPixelSize(R.dimen.button_padding_vertical_material);
    int insetH = context.getResources()
            .getDimensionPixelSize(R.dimen.button_inset_horizontal_material);
    int insetV = context.getResources()
            .getDimensionPixelSize(R.dimen.button_inset_vertical_material);

    float[] outerRadii = new float[8];
    Arrays.fill(outerRadii, CORNER_RADIUS);

    RoundRectShape r = new RoundRectShape(outerRadii, null, null);

    ShapeDrawable shapeDrawable = new ShapeDrawable(r);
    shapeDrawable.getPaint().setColor(color);
    shapeDrawable.setPadding(paddingH, paddingV, paddingH, paddingV);

    return new InsetDrawable(shapeDrawable,
            insetH, insetV, insetH, insetV);
}
 
源代码11 项目: SublimePicker   文件: SUtils.java
public static Drawable createBgDrawable(int color, int rTopLeft,
                                        int rTopRight, int rBottomRight,
                                        int rBottomLeft) {
    float[] outerRadii = new float[8];
    outerRadii[0] = rTopLeft;
    outerRadii[1] = rTopLeft;
    outerRadii[2] = rTopRight;
    outerRadii[3] = rTopRight;
    outerRadii[4] = rBottomRight;
    outerRadii[5] = rBottomRight;
    outerRadii[6] = rBottomLeft;
    outerRadii[7] = rBottomLeft;

    RoundRectShape r = new RoundRectShape(outerRadii, null, null);

    ShapeDrawable shapeDrawable = new ShapeDrawable(r);
    shapeDrawable.getPaint().setColor(color);

    return shapeDrawable;
}
 
源代码12 项目: a   文件: BadgeView.java
public void setBackground(float dipRadius, int badgeColor) {
    int radius = dip2Px(dipRadius);
    float[] radiusArray = new float[]{radius, radius, radius, radius, radius, radius, radius, radius};

    RoundRectShape roundRect = new RoundRectShape(radiusArray, null, null);
    ShapeDrawable bgDrawable = new ShapeDrawable(roundRect);
    bgDrawable.getPaint().setColor(badgeColor);
    setBackground(bgDrawable);
}
 
源代码13 项目: LoadingButton   文件: LoadingButton.java
private LayerDrawable createDrawable(int radius, int topColor, int bottomColor) {

        float[] outerRadius = new float[]{radius, radius, radius, radius, radius, radius, radius, radius};

        //Top
        RoundRectShape topRoundRect = new RoundRectShape(outerRadius, null, null);
        ShapeDrawable topShapeDrawable = new ShapeDrawable(topRoundRect);
        topShapeDrawable.getPaint().setColor(topColor);
        //Bottom
        RoundRectShape roundRectShape = new RoundRectShape(outerRadius, null, null);
        ShapeDrawable bottomShapeDrawable = new ShapeDrawable(roundRectShape);
        bottomShapeDrawable.getPaint().setColor(bottomColor);
        //Create array
        Drawable[] drawArray = {bottomShapeDrawable, topShapeDrawable};
        LayerDrawable layerDrawable = new LayerDrawable(drawArray);

        //Set shadow height
        if (isShadowEnabled && topColor != Color.TRANSPARENT) {
            //unpressed drawable
            layerDrawable.setLayerInset(0, 0, 0, 0, 0);  /*index, left, top, right, bottom*/
        } else {
            //pressed drawable
            layerDrawable.setLayerInset(0, 0, mShadowHeight, 0, 0);  /*index, left, top, right, bottom*/
        }
        layerDrawable.setLayerInset(1, 0, 0, 0, mShadowHeight);  /*index, left, top, right, bottom*/

        return layerDrawable;

    }
 
源代码14 项目: YCRedDotView   文件: YCRedDotView.java
/**
 * 设置背景颜色
 * @param dipRadius                 半径
 * @param badgeColor                颜色
 */
private void setBackground(int dipRadius, int badgeColor) {
    int radius = dip2Px(dipRadius);
    float[] radiusArray = new float[]{radius, radius, radius, radius,
            radius, radius, radius, radius};
    RoundRectShape roundRect = new RoundRectShape(radiusArray, null, null);
    ShapeDrawable bgDrawable = new ShapeDrawable(roundRect);
    bgDrawable.getPaint().setColor(badgeColor);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        setBackground(bgDrawable);
    }
}
 
源代码15 项目: dhis2-android-capture-app   文件: RFABShape.java
public static ShapeDrawable generateCornerShapeDrawable(int color, int topLeftCorner, int topRightCorner, int bottomRightCorner, int bottomLeftCorner) {
    Shape shape = new RoundRectShape(new float[]{topLeftCorner, topLeftCorner, topRightCorner, topRightCorner, bottomRightCorner, bottomRightCorner, bottomLeftCorner, bottomLeftCorner}, null, null);
    ShapeDrawable sd = new ShapeDrawable(shape);
    sd.getPaint().setColor(color);
    sd.getPaint().setStyle(Paint.Style.FILL);
    return sd;
}
 
源代码16 项目: dhis2-android-capture-app   文件: RFABShape.java
public static ShapeDrawable generateCornerStrokeDrawable(int color, float width, int topLeftCorner, int topRightCorner, int bottomRightCorner, int bottomLeftCorner) {
    Shape shape = new RoundRectShape(new float[]{topLeftCorner, topLeftCorner, topRightCorner, topRightCorner, bottomRightCorner, bottomRightCorner, bottomLeftCorner, bottomLeftCorner}, null, null);
    ShapeDrawable sd = new ShapeDrawable(shape);
    sd.getPaint().setColor(color);
    sd.getPaint().setStyle(Paint.Style.STROKE);
    sd.getPaint().setAntiAlias(true);
    sd.getPaint().setStrokeWidth(width);
    return sd;
}
 
源代码17 项目: WanAndroid   文件: ViewHelper.java
@NonNull
private static Drawable getRippleMask(int color) {
    float[] outerRadii = new float[8];
    Arrays.fill(outerRadii, 3);
    RoundRectShape r = new RoundRectShape(outerRadii, null, null);
    ShapeDrawable shapeDrawable = new ShapeDrawable(r);
    shapeDrawable.getPaint().setColor(color);
    return shapeDrawable;
}
 
源代码18 项目: litho   文件: ShowMessageExampleComponentSpec.java
private static Drawable buildRoundedRect(int radius) {
  final float[] radii = new float[8];
  Arrays.fill(radii, radius);
  final RoundRectShape roundedRectShape = new RoundRectShape(radii, null, radii);
  final ShapeDrawable drawable = new ShapeDrawable(roundedRectShape);
  drawable.getPaint().setColor(Color.RED);
  return drawable;
}
 
源代码19 项目: litho   文件: ExpandableElementUtil.java
static ShapeDrawable getMessageBackground(ComponentContext c, int color) {
  final RoundRectShape roundedRectShape =
      new RoundRectShape(
          new float[] {40, 40, 40, 40, 40, 40, 40, 40},
          null,
          new float[] {40, 40, 40, 40, 40, 40, 40, 40});
  final ShapeDrawable oval = new ShapeDrawable(roundedRectShape);
  oval.getPaint().setColor(color);
  return oval;
}
 
源代码20 项目: litho   文件: FastScrollHandleComponentSpec.java
private static Drawable buildCircleDrawable(ComponentContext c, int color, int radiusDp) {
  final float radiusPx =
      TypedValue.applyDimension(
          TypedValue.COMPLEX_UNIT_DIP, radiusDp, c.getResources().getDisplayMetrics());

  final float[] radii = new float[8];
  Arrays.fill(radii, radiusPx);

  final RoundRectShape roundedRectShape = new RoundRectShape(radii, null, radii);

  final ShapeDrawable drawable = new ShapeDrawable(roundedRectShape);
  drawable.getPaint().setColor(color);
  return drawable;
}
 
源代码21 项目: XERUNG   文件: TextDrawable.java
private void drawBorder(Canvas canvas) {
    RectF rect = new RectF(getBounds());
    rect.inset(borderThickness/2, borderThickness/2);

    if (shape instanceof OvalShape) {
        canvas.drawOval(rect, borderPaint);
    }
    else if (shape instanceof RoundRectShape) {
        canvas.drawRoundRect(rect, radius, radius, borderPaint);
    }
    else {
        canvas.drawRect(rect, borderPaint);
    }
}
 
源代码22 项目: NHentai-android   文件: TextDrawable.java
@Override
public IBuilder roundRect(int radius) {
	this.radius = radius;
	float[] radii = {radius, radius, radius, radius, radius, radius, radius, radius};
	this.shape = new RoundRectShape(radii, null, null);
	return this;
}
 
源代码23 项目: android-flat-button   文件: FButton.java
private LayerDrawable createDrawable(int radius, int topColor, int bottomColor) {

        float[] outerRadius = new float[]{radius, radius, radius, radius, radius, radius, radius, radius};

        //Top
        RoundRectShape topRoundRect = new RoundRectShape(outerRadius, null, null);
        ShapeDrawable topShapeDrawable = new ShapeDrawable(topRoundRect);
        topShapeDrawable.getPaint().setColor(topColor);
        //Bottom
        RoundRectShape roundRectShape = new RoundRectShape(outerRadius, null, null);
        ShapeDrawable bottomShapeDrawable = new ShapeDrawable(roundRectShape);
        bottomShapeDrawable.getPaint().setColor(bottomColor);
        //Create array
        Drawable[] drawArray = {bottomShapeDrawable, topShapeDrawable};
        LayerDrawable layerDrawable = new LayerDrawable(drawArray);

        //Set shadow height
        if (isShadowEnabled && topColor != Color.TRANSPARENT) {
            //unpressed drawable
            layerDrawable.setLayerInset(0, 0, 0, 0, 0);  /*index, left, top, right, bottom*/
        } else {
            //pressed drawable
            layerDrawable.setLayerInset(0, 0, mShadowHeight, 0, 0);  /*index, left, top, right, bottom*/
        }
        layerDrawable.setLayerInset(1, 0, 0, 0, mShadowHeight);  /*index, left, top, right, bottom*/

        return layerDrawable;
    }
 
源代码24 项目: XERUNG   文件: TextDrawable.java
@Override
public IBuilder roundRect(int radius) {
    this.radius = radius;
    float[] radii = {radius, radius, radius, radius, radius, radius, radius, radius};
    this.shape = new RoundRectShape(radii, null, null);
    return this;
}
 
源代码25 项目: mvvm-template   文件: ViewHelper.java
@NonNull private static Drawable getRippleMask(int color) {
    float[] outerRadii = new float[8];
    Arrays.fill(outerRadii, 3);
    RoundRectShape r = new RoundRectShape(outerRadii, null, null);
    ShapeDrawable shapeDrawable = new ShapeDrawable(r);
    shapeDrawable.getPaint().setColor(color);
    return shapeDrawable;
}
 
源代码26 项目: AccountBook   文件: ZProgressBar.java
/**
 * 根据 radius 和 color 来创建 ShapeDrawable
 * @param radius 弧度
 * @param color  颜色
 * @return drawable
 */
private Drawable createShape(float radius, int color){
    ShapeDrawable shape = new ShapeDrawable();
    // 设置弧度
    radius = dp2px(radius);
    float[] outerRadii = new float[]{radius, radius, radius, radius, radius, radius, radius, radius};
    RoundRectShape roundShape = new RoundRectShape(outerRadii, null, null);
    shape.setShape(roundShape);
    // 设置颜色
    shape.getPaint().setColor(color);
    return shape;
}
 
源代码27 项目: SweetTips   文件: SweetToast.java
/**
 * 根据指定的背景色,获得当前SweetToast实例中mContentView的背景drawable实例
 * @param backgroundColor
 * @return
 */
private static Drawable getBackgroundDrawable(SweetToast sweetToast, @ColorInt int backgroundColor){
    try {
        ShapeDrawable shapeDrawable = new ShapeDrawable();
        //获取当前设备的屏幕尺寸
        //实验发现不同的设备上面,Toast内容区域的padding值并不相同,根据屏幕的宽度分别进行处理,尽量接近设备原生Toast的体验
        int widthPixels = sweetToast.getContentView().getResources().getDisplayMetrics().widthPixels;
        int heightPixels = sweetToast.getContentView().getResources().getDisplayMetrics().heightPixels;
        float density = sweetToast.getContentView().getResources().getDisplayMetrics().density;
        if(widthPixels >= 1070){
            //例如小米5S:1920 x 1080
            shapeDrawable.setPadding((int)(density*13),(int)(density*12),(int)(density*13),(int)(density*12));
        }else {
            //例如红米2:1280x720
            shapeDrawable.setPadding((int)(density*14),(int)(density*13),(int)(density*14),(int)(density*13));
        }
        float radius = density*8;
        float[] outerRadii = new float[]{radius,radius,radius,radius,radius,radius,radius,radius};
        int width = sweetToast.getContentView().getWidth();
        int height = sweetToast.getContentView().getHeight();
        RectF rectF = new RectF(1,1,width-1,height-1);
        RoundRectShape roundRectShape = new RoundRectShape(outerRadii,rectF,null);
        shapeDrawable.setShape(roundRectShape);
        //在Android 5.0以下,直接设置 DrawableCompat.setTint 未变色:DrawableCompat.setTint(shapeDrawable,backgroundColor);

        //解决:不使用DrawableCompat,直接使用 Drawable.setColorFilter(backgroundColor, PorterDuff.Mode.SRC_ATOP),
        //经测试,在4.22(山寨机)和5.1(中兴)和6.0.1(小米5s)上颜色正常显示
        shapeDrawable.setColorFilter(backgroundColor, PorterDuff.Mode.SRC_ATOP);
        return shapeDrawable;
    }catch (Exception e){
        Log.e("幻海流心","e:"+e.getLocalizedMessage());
    }
    return null;
}
 
源代码28 项目: Trivia-Knowledge   文件: FButton.java
private LayerDrawable createDrawable(int radius, int topColor, int bottomColor) {

        float[] outerRadius = new float[]{radius, radius, radius, radius, radius, radius, radius, radius};

        //Top
        RoundRectShape topRoundRect = new RoundRectShape(outerRadius, null, null);
        ShapeDrawable topShapeDrawable = new ShapeDrawable(topRoundRect);
        topShapeDrawable.getPaint().setColor(topColor);
        //Bottom
        RoundRectShape roundRectShape = new RoundRectShape(outerRadius, null, null);
        ShapeDrawable bottomShapeDrawable = new ShapeDrawable(roundRectShape);
        bottomShapeDrawable.getPaint().setColor(bottomColor);
        //Create array
        Drawable[] drawArray = {bottomShapeDrawable, topShapeDrawable};
        LayerDrawable layerDrawable = new LayerDrawable(drawArray);

        //Set shadow height
        if (isShadowEnabled && topColor != Color.TRANSPARENT) {
            //unpressed drawable
            layerDrawable.setLayerInset(0, 0, 0, 0, 0);  /*index, left, top, right, bottom*/
        } else {
            //pressed drawable
            layerDrawable.setLayerInset(0, 0, mShadowHeight, 0, 0);  /*index, left, top, right, bottom*/
        }
        layerDrawable.setLayerInset(1, 0, 0, 0, mShadowHeight);  /*index, left, top, right, bottom*/

        return layerDrawable;
    }
 
源代码29 项目: AdPlayBanner   文件: PointView.java
private void change() {
    float[] outerR = new float[]{mSize / 2, mSize / 2, mSize / 2, mSize / 2, mSize / 2, mSize / 2, mSize / 2, mSize / 2};
    Shape shape = new RoundRectShape(outerR, null, null);
    ShapeDrawable shapeDrawable = new ShapeDrawable(shape);
    shapeDrawable.setIntrinsicHeight((int) mSize);
    shapeDrawable.setIntrinsicWidth((int) mSize);
    shapeDrawable.setPadding(0, 0, 0, 0);
    shapeDrawable.getPaint().setColor(mColor);
    shapeDrawable.getPaint().setStyle(Paint.Style.FILL);
    setBackgroundDrawable(shapeDrawable);
    setHeight((int) mSize);
    setMinWidth((int) mSize);
}
 
源代码30 项目: RapidFloatingActionButton   文件: RFABShape.java
public static ShapeDrawable generateCornerStrokeDrawable(int color, float width, int topLeftCorner, int topRightCorner, int bottomRightCorner, int bottomLeftCorner) {
    Shape shape = new RoundRectShape(new float[]{topLeftCorner, topLeftCorner, topRightCorner, topRightCorner, bottomRightCorner, bottomRightCorner, bottomLeftCorner, bottomLeftCorner}, null, null);
    ShapeDrawable sd = new ShapeDrawable(shape);
    sd.getPaint().setColor(color);
    sd.getPaint().setStyle(Paint.Style.STROKE);
    sd.getPaint().setAntiAlias(true);
    sd.getPaint().setStrokeWidth(width);
    return sd;
}
 
 类方法
 同包方法