create GradientDrawable from radius and color - Android Graphics

Android examples for Graphics:Gradient Color

Description

create GradientDrawable from radius and color

Demo Code


//package com.java2s;

import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;

public class Main {

    public static Drawable createShape(int radius, int color) {
        GradientDrawable normalDrawable = new GradientDrawable();
        normalDrawable.setCornerRadius(radius);
        normalDrawable.setColor(color);//from  www  .  ja  v a 2 s .c  om
        return normalDrawable;
    }
}

Related Tutorials