Reputation: 219
This button is displaying a purple color and its XML code is
android:id="@+id/btnLogin"
android:layout_width="128dp"
android:layout_height="wrap_content"
android:layout_marginStart="141dp"
android:layout_marginEnd="142dp"
android:layout_marginBottom="48dp"
android:background="@drawable/btn_login"
android:fontFamily="@font/poppins"
android:text="Login"
android:textAllCaps="false"
android:textSize="18sp"
app:layout_constraintBottom_toTopOf="@+id/tvCreateAccount"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
"@drawable/btn_login" is a shape I created -
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#71D775">
</solid>
<corners android:radius="66dp">
</corners>
</shape>
And this is how it looks like,
Upvotes: 2
Views: 862
Reputation: 1045
This is because the default MaterialButton
style overrides backgroundTint
.
So if we are using a custom android:background
, we have to make sure to null out backgroundTint
. We can achieve it by any of the following way:
Add any of these line to your button XML.
app:backgroundTint="@null"
OR
app:backgroundTint="@empty"
Upvotes: 4
Reputation: 104
For some reason, you need to set the app:backgroundTint to null. Like so:
app:backgroundTint="@null"
Upvotes: 1