Android examples for Graphics:Drawable Operation
get Corner Radii Drawable
//package com.java2s; import android.graphics.Canvas; import android.graphics.drawable.GradientDrawable; public class Main { public static GradientDrawable getCornerRadiiDrawable(float radius, int color) { GradientDrawable drawable = new GradientDrawable(); drawable.setCornerRadii(new float[] { radius, radius, radius, radius, radius, radius, radius, radius }); drawable.setColor(color);//from w w w . ja v a2 s. c o m return drawable; } public static GradientDrawable getCornerRadiiDrawable(float[] radii, int color) { GradientDrawable drawable = new GradientDrawable() { @Override public void draw(Canvas canvas) { super.draw(canvas); } }; drawable.setCornerRadii(radii); drawable.setColor(color); return drawable; } }