📌  相关文章
📜  如何以编程方式为背景创建形状 - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:32.692000             🧑  作者: Mango

代码示例1
public static void customView(View v, int backgroundColor, int borderColor) {
    GradientDrawable shape = new GradientDrawable();
    shape.setShape(GradientDrawable.RECTANGLE);
    shape.setCornerRadii(new float[] { 8, 8, 8, 8, 0, 0, 0, 0 });
    shape.setColor(backgroundColor);
    shape.setStroke(3, borderColor);
    v.setBackground(shape);
}