You can achieve this with <layer-list /> drawable . In it, place <item /> , which contains <bitmap /> (an example stolen from the documentation of the developer):
<item> <bitmap android:src="@drawable/image" android:gravity="center" /> </item>
Then your other item may just be a solid color. Create a resource that has only that solid color, and then combine them:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/your_color" /> <item> <bitmap android:src="@drawable/image" android:gravity="center" /> </item> </layer-list>
(You may have to reverse the order of the <item /> tags, I forgot whatβs on top.)
Eric
source share