Andorid Programmatic Shapes With Gradient

You can fairly easy make rounded rectangles in Android by using the GradientDrawable class

GradientDrawable gd = new GradientDrawable();
gd.setColor(Color.RED);
gd.setCornerRadius(10);
gd.setStroke(2, Color.WHITE);

Take a further look at this blogpost for more examples.

 

Posted in Android, Tips and Tricks Tagged with: , ,