float mRadius=3f; GradientDrawable drawable=new GradientDrawable(); drawable.setShape(GradientDrawable.RECTANGLE); drawable.setCornerRadii(new float[]{mRadius, mRadius, 0, 0, 0, 0, mRadius, mRadius});