Tutorial by Examples

A drawable can be tinted a certain color. This is useful for supporting different themes within your application, and reducing the number of drawable resource files. Using framework APIs on SDK 21+: Drawable d = context.getDrawable(R.drawable.ic_launcher); d.setTint(Color.WHITE); Using android...
Create drawable file named with custom_rectangle.xml in drawable folder: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <solid android:color=&quo...
For a circular View (in this case TextView) create a drawble round_view.xml in drawble folder: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <solid...
Extend your class with Drawable and override these methods public class IconDrawable extends Drawable { /** * Paint for drawing the shape */ private Paint paint; /** * Icon drawable to be drawn to the center of the shape */ private Drawable icon; /**...

Page 1 of 1