Create GradientDrawable - Android Graphics

Android examples for Graphics:Drawable

Description

Create GradientDrawable

Demo Code


//package com.java2s;

import android.graphics.drawable.GradientDrawable;

public class Main {

    public static GradientDrawable getDrawable(int radius, int fillColor,
            int width, int strokeColor) {
        GradientDrawable gradientDrawable = new GradientDrawable();
        gradientDrawable.setCornerRadius(radius);
        gradientDrawable.setColor(fillColor);
        gradientDrawable.setStroke(width, strokeColor);
        return gradientDrawable;
    }/*from w ww.  j ava 2  s  .co m*/
}

Related Tutorials