Answers for "how to create shapes for background programmatically"

0

how to create shapes for background programmatically

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);
}
Posted by: Guest on January-27-2021

Code answers related to "how to create shapes for background programmatically"

Browse Popular Code Answers by Language