GradientDrawable shape = new GradientDrawable(); shape.setCornerRadius( 12 ); shape.setColor(Color.RED); View view = ... view.setBackground(shape); ref : https://stackoverflow.com/questions/18391830/how-to-programmatically-round-corners-and-set-random-background-colors