HumanOidRoBo HumanOidRoBo - 4 months ago 21
Android Question

Putting an image on button in Android

I have created an Android app in which I used two buttons and for those buttons I have designed images to fill the button's width and height properly.

I have saved the image as

PNG
that is 1000 x 1000 pixels but when I put the image on button its resolution is messed up.

This is the image for my button

Answer

You just use an ImageButton and make the background whatever you want and set the icon as the src.

<ImageButton
android:id="@+id/ImageButton01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/album_icon"
android:background="@drawable/As_ur_Design" />