'How do I change button's shape into round without changing button backround image

so I'm new into android studio and I am creating an app I want to change all button corners into round but without changing the color of the buttons in drawables because in every button backround I have put an image, I just dont know how to do it



Solution 1:[1]

You can use ImageButton.

Put this ImageButton to your layout xml.

<ImageButton
    android:id="@+id/imageButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/button_background"
    app:srcCompat="@drawable/button_drawable" />

button_drawable is your button image drawable.

Create button_background.xml drawable into drawable resource.

Drawable > New > Drawable Resource File (example: button_background.xml) Add this code :

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <corners  android:radius="10dp"/>
    <solid android:color="@color/red"></solid>
</shape>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 BluePine