Rounded corners android image buttons

Use Shape in android to make the rounder corners

create the xml file named it as roundcorner.xml

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

In your ImageButton add this attribute android:background="@drawable/roundcorner"

<ImageButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/imageButton"
                android:layout_marginTop="57dp"
                android:src="https://stackoverflow.com/questions/21633637/@drawable/friends"
                android:background="@drawable/roundcorner"
                android:padding="1dp"
                android:layout_alignParentTop="true"
                android:layout_toLeftOf="@+id/imageButton2"
                android:layout_marginRight="62dp" />

Leave a Comment