Java tutorial
//package com.java2s; import android.graphics.drawable.GradientDrawable; import android.os.Build; import android.view.View; public class Main { public static void makeRoundCorner(View v, int color, int radius) { GradientDrawable gradientDrawable = new GradientDrawable(); gradientDrawable.setColor(color); gradientDrawable.setCornerRadius(radius); if (Build.VERSION.SDK_INT < 16) v.setBackgroundDrawable(gradientDrawable); else v.setBackground(gradientDrawable); } }