Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

android dynamically create layer-list with item and shape site:stackoverflow.com

    GradientDrawable layer1 = new GradientDrawable();
    layer1.setShape(GradientDrawable.OVAL);
    layer1.setSize(33,33);
    layer1.setColor(Color.WHITE);
    layer1.setStroke(4,Color.RED);

    GradientDrawable layer2 = new GradientDrawable();
    layer2.setShape(GradientDrawable.OVAL);
    layer2.setColor(Color.BLUE);

    InsetDrawable insetLayer2 = new InsetDrawable(layer1, 8, 8, 8, 8);

    LayerDrawable layerDrawable = new LayerDrawable(new Drawable[]
    {insetLayer2,layer2});
    button.setBackground(layerDrawable);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #android #dynamically #create #item #shape
ADD COMMENT
Topic
Name
3+3 =