Search code examples
javaandroidimagebuttonrounded-corners

ImageButton with rounded corner using xml only?


I'm trying to make a ImageButton like this

this is the type of button I'm trying to replicate

however, I can't seem to find a way to do it using xml only. I tried custom libraries, they don't seem to work perfectly. is there no other way? what can I do instead of using ImageButton?


Solution

  • You can use cardview with card corner radius

    <android.support.v7.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:cardCornerRadius="4dp"/>
    

    And add imagebutton inside cardview