How to add image for button in android?


Question

How can I add an image to a button, rather than text?

1
32
7/18/2013 12:40:03 AM

Accepted Answer

Rather humorously, considering your tags, just use the ImageButton widget.

72
1/6/2016 11:57:35 PM

Simply use ImageButton View and set image for it:`

 <ImageButton
    android:id="@+id/searchImageButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignParentRight="true"
    android:src="@android:drawable/ic_menu_search" />

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon