Java tutorial
//package com.java2s; //License from project: Open Source License import android.graphics.drawable.ShapeDrawable; import android.graphics.drawable.shapes.OvalShape; public class Main { public static ShapeDrawable getShapeDrawable(int size, int color) { ShapeDrawable circle = new ShapeDrawable(new OvalShape()); circle.setIntrinsicHeight(size); circle.setIntrinsicWidth(size); circle.getPaint().setColor(color); return circle; } }