I have created an xml file called rounded_button.xml for a custom rounded button design that I plan on using in my login screen.
This is the code I have in my xml file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/colorPrimaryDark"/>
<corners
android:topRightRadius="100px"
android:topLeftRadius="100px"
android:bottomRightRadius="100px"
android:bottomLeftRadius="100px"
/>
</shape>
I have tried to implement it in my login screen like this
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
tools:context=".LoginActivity">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Round"
android:background="@drawable/round_button"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
However, the button is still rectangular, and even if I increase the corner sizes, it won't round the edges
- What have I done wrong?
- Is there a better way to structure my xml file to round the button?