To have a button with image, text and background in android . Edit the button tag on the .xml file as follows
Sample:
Here the above sample code is to align the image on top of the text in a button. It is also possible to align the image to the right ,left and bottom of the text by using
Sample:
<Button android:id="@+id/ButtonTest" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/ic_btn_bg" android:drawableTop="@drawable/ic_btn_img" android:text="My Button" android:textColor="#FFFFFF" > </Button>
Here the above sample code is to align the image on top of the text in a button. It is also possible to align the image to the right ,left and bottom of the text by using
android:drawableBottom/Rigth/Left="@drawable/ic_btn_img"