Im trying to create a ImageButton with a image inside. I need the ImageButtons image to have round edges.
But here comes the BUT... Instead of making the image smaller inside the button, to make it fit inside the element, I would like to have the images corners rounded or cut off.
This is what I have done so far:
drawable: my_image_drawable
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffffff" />
<corners
android:bottomLeftRadius="50dp"
android:bottomRightRadius="50dp"
android:topLeftRadius="50dp"
android:topRightRadius="50dp" />
</shape>
activity_main.xml:
<ImageButton
android:background="@drawable/card_imageview_drawable"
android:layout_weight="1"
android:id="@+id/my_image_button"
android:layout_toRightOf="@+id/my_textview"
android:src="@drawable/my_image_drawable"
style="@style/my_imageview_style"/>
This code does exactly what I don't wont it to do. It makes the image smaller inside the ImageButton and it does not cut the corners
Note: I cannot use ImageView (instead of ImageButton) because it limits the gestures I can utilise.
All advice is welcome! Thank you