0

I have tried to get an image button of round shape. But it is displaying the circular image with a square shaped background but i need only the image without any background. I also used round_image.XML as background drawable file but its not working.

menu.xml

<ImageButton
android:id="@+id/imageButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true"      android:src="@drawable/sliderr" android:background="@drawable/round_image"/>

round_image.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"android:shape="oval">
<gradient android:startColor="#50d050                                       
android:endColor="#008000" android:angle="270"/>
<stroke 
android:width="1px"
 android:color="#000000"/>
</shape>

1 Answers1

0

Use this corner , instead of yours

 <shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="@color/colorPrimary" />
    <stroke android:color="@color/colorPrimary" />
    <corners
        android:bottomLeftRadius="5dp"
        android:bottomRightRadius="5dp"
        android:topLeftRadius="5dp"
        android:topRightRadius="5dp" />
</shape>
Ko Vartthan
  • 434
  • 1
  • 4
  • 22