Search code examples
androidbuttonandroid-drawable

How to make rounded and bordered button android?


I am making a rounded and bordered button. But I am getting button with only primary color in the theme. Here is my code in circular button drawable file:-

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@color/green" />
    <corners android:radius="50dp" />
    <stroke
        android:width="10dp"
        android:color="@color/red_primary" />
</shape>

here is my button code:-

               <Button
                android:id="@+id/feedback_btn"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:layout_marginHorizontal="5dp"
                android:layout_weight="1"
                android:padding="10dp"
                android:background="@drawable/circular_button"
                android:text="@string/send_feedback"
                android:textColor="@color/white" />

Solution

  • also add app:backgroundTint="@null" in Button tag.