get Label Color Drawable - Android Graphics

Android examples for Graphics:Drawable

Description

get Label Color Drawable

Demo Code


import android.graphics.drawable.Drawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.RoundRectShape;

public class Main{
    private static final int INTRINSIC_SHAPE_SIZE = 52;
    public static Drawable getLabelColorDrawable(int index) {
        float[] r = new float[] { 4, 4, 4, 4, 4, 4, 4, 4 };
        ShapeDrawable shape = new ShapeDrawable(new RoundRectShape(r, null,
                null));//from   w  w w  . j  av a2s  . c o m
        shape.setIntrinsicWidth(INTRINSIC_SHAPE_SIZE);
        shape.setIntrinsicHeight(INTRINSIC_SHAPE_SIZE);
        //shape.getPaint().setColor();

        return shape;
    }
}

Related Tutorials