Reputation: 1
<Button
android:id="@+id/signInBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="68dp"
android:background="@drawable/gradient"
android:drawableEnd="@drawable/rounded_arrow_forward_ios_24"
android:fontFamily="@font/alata"
android:paddingVertical="10dp"
android:text="@string/sign_in"
android:textFontWeight="600"
android:textSize="16sp"
app:iconPadding="140dp"
app:iconSize="25dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tagline" />
I have two buttons in my XML layout file, one for signing in and the other for signing up. The sign-in button has a gradient background, but the sign-in button's background remains the default blue color. I'm trying to change the outline color for the sign-up button but attempts to use background Tint
or foreground Tint
change the entire background color instead. I've already tried clearing the cache and restarting, but the issue persists.
How can I properly change the outline color for the sign-up button without affecting the entire background and the background of sign-in button?
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:startColor="@color/orange"
android:endColor="@color/lightBlue"
android:angle="270"/>
<corners android:radius="40dp"/>
</shape>
<Button
android:id="@+id/signUpBtn"
style="?attr/materialButtonOutlinedStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableEnd="@drawable/rounded_arrow_forward_ios_24"
android:fontFamily="@font/alata"
android:paddingVertical="10dp"
android:text="@string/sign_up"
android:textColor="@color/white"
android:textFontWeight="600"
android:textSize="16sp"
app:iconPadding="140dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/signInBtn" />
Upvotes: 0
Views: 27
Reputation: 122
To change the outline color for the sign-up button without affecting the entire background, use the 'android:backgroundTint' attribute. Add the below line to sign-up button XML
android:backgroundTint="@color/DesiredOutlineColor"
Add your desired color to above line.
Upvotes: 0