android image button
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/round_button" />
Android: combining text & image on a Button or ImageButton
You can call setBackground()
on a Button
to set the background of the button.
Any text will appear above the background.
If you are looking for something similar in xml there is:android:background
attribute which works the same way.
Make borderless image button small on Android
You should use:
android:background="?selectableItemBackgroundBorderless"
Difference in appearance of Button and ImageButton
Button
has default elevation (actually, it has a StateListAnimator
that provides elevation when the button is enabled) under the Material theme, whereas ImageButton
does not.
Android ImageButton does not display image, even though it is visible in the Designer preview
try using only src instead of srcCompat and see if it works
Related Topics
Upload an Image and Audio in One Request in Android
How to Get Release Build APK File Using Proguard
Android Music Seekbar Is Not Working (Idle)
How to Automate the Android Sdk Installation
ASP.NET Web API Authentication
How to Hide Underbar in Edittext
How to Get App's Permission for Each App? How to Do It Programmatically on Android
Android:How to Capture a Image of Gps Location
Rotating Phone Quickly 180 Degrees, Camera Preview Turns Upside Down
Problem to Achieve Curved Animation
Search in Listview with Edittext
Adding Local .Aar Files to My Gradle Build
The Process of the Service Is Killed After the Application Is Removed from the Application Tray
Creating a PDF File in Android Programmatically and Writing in It
Listview in Arrayadapter Order Get's Mixed Up When Scrolling