我有ShapeDrawable
:
final ShapeDrawable drawable = new ShapeDrawable(shape);
drawable.getPaint().setStyle(Paint.Style.FILL);
drawable.getPaint().setColor(0xFFffffff);
我想为这个drawable设置边框(笔触)颜色和宽度。
我尝试setStyle(Paint.Style.FILL_AND_STROKE)
但它用相同的颜色设置背景和边框
答案 0 :(得分:3)
使用
drawable.getPaint().setStyle(Paint.Style.STROKE);
drawable.getPaint().setStrokeWidth(2); // in pixel