<Button android:id="@+id/Button2" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:onClick="addGroup" android:text="TEXT" android:background="@drawable/addgroup"/>
To add background and image and text at the same time.
Just replace
android:background="@drawable/addgroup"
from
android:background="@android:color/transparent" android:drawableTop="@drawable/addgroup" android:text="TEXT"
You can also use attributes in the Button layout with properties that determine the source of the image that fits inside the button.
android:drawableLeft android:drawableRight android:drawableBottom android:drawableTop
Vikalp Patel
source share