Skip to content

Instantly share code, notes, and snippets.

@shau-lok
Created April 15, 2016 09:29
Show Gist options
  • Save shau-lok/b45a5069179df55f63fb9fd93b547944 to your computer and use it in GitHub Desktop.
Save shau-lok/b45a5069179df55f63fb9fd93b547944 to your computer and use it in GitHub Desktop.
ShapeDrawable 用法
ShapeDrawable rectChecked = new ShapeDrawable(new RectShape());
rectChecked.getPaint().setColor(0xfffffff);
rectChecked.getPaint().setStyle(Paint.Style.STROKE);
rectChecked.getPaint().setStrokeWidth(strokeWidth);
rectChecked.setIntrinsicHeight(bitmap.getHeight() + strokeWidth);
rectChecked.setIntrinsicWidth(bitmap.getWidth() + strokeWidth);
Drawable[] drawableArray = new Drawable[]{bmp,rectChecked};
LayerDrawable layerChecked = new LayerDrawable(drawableArray);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment