Amir Panahandeh
Amir Panahandeh

Reputation: 9039

Rounded shape as background for button not showing correctly

I've a round shape like this

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

and I'm using it as background for buttons

         <Button
            android:id="@+id/button"
            android:layout_width="84dp"
            android:layout_height="34dp"
            android:layout_below="@id/like"
            android:layout_marginTop="14dp"
            android:background="@drawable/button_shape"
            android:textColor="@color/white" />

and in android studio preview it showing a round button

enter image description here

but In application I'm getting this

enter image description here

How can I fix it?

Upvotes: 0

Views: 1271

Answers (4)

Amir Panahandeh
Amir Panahandeh

Reputation: 9039

I forgot to check the java code which I was setting color as background of button and after removing that part of code it's working great

Upvotes: 0

Mihaela Tudurache
Mihaela Tudurache

Reputation: 41

I had same issue. Try to set smaller width for button

Upvotes: 0

convexHull
convexHull

Reputation: 1881

Try to define each corner separately... Instead of raduis define all: bottomLeftRadius, bottomRightRadius, topLeftRadius, topRightRadius

Upvotes: 0

Prashant Kumar Sharma
Prashant Kumar Sharma

Reputation: 1118

Increase the radius in background drawable file...

Upvotes: 1

Related Questions