Any clue why the button appears white when it is o...
# android
j
Any clue why the button appears white when it is orange when i design it?
😶 7
r
What does your xml look like? It's possible that you set
tools
properties instead of
app
or `android`; those will only show up in the editor.
j
Copy code
<?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:theme="@style/AppTheme"
    tools:context="ferm.jonny.create_job.presentation.fragments.AddJobFragment">

    <Button
        android:id="@+id/addJob_button"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_marginBottom="32dp"
        android:background="@drawable/round_button"
        android:backgroundTint="#FC7E2F"
        android:fontFamily="@font/montserrat_bold"
        android:text="upload job"
        android:textColor="#FFFFFF"
        android:textSize="18sp"
        android:textStyle="bold"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        tools:visibility="visible" />

    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="22dp"
        android:layout_marginEnd="22dp"
        android:src="@drawable/ic__buyer_home"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <LinearLayout
        android:id="@+id/linearLayout3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="32dp"
        android:layout_marginTop="100dp"
        android:layout_marginBottom="214dp"
        android:orientation="horizontal"
        app:layout_constraintBottom_toTopOf="@+id/imageView2"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="@font/montserrat_bold"
            android:text="Hi "
            android:textSize="24sp" />

        <TextView
            android:id="@+id/textView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="@font/montserrat_bold"
            android:text="Joshua"
            android:textSize="24sp" />

        <TextView
            android:id="@+id/textView6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:fontFamily="@font/montserrat_bold"
            android:text="."
            android:textSize="24sp" />
    </LinearLayout>

    <TextView
        android:id="@+id/textView12"
        android:layout_width="295dp"
        android:layout_height="79dp"
        android:layout_marginStart="32dp"
        android:layout_marginTop="8dp"
        android:fontFamily="@font/montserrat"
        android:text="Got something to get done? \nUpload a job here and our sellers will finish it in no time."
        android:textSize="18sp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/linearLayout3" />
</androidx.constraintlayout.widget.ConstraintLayout>
@Russell Stewart
Should I delete
Copy code
xmlns:tools="<http://schemas.android.com/tools>"
?
r
This is the button in question, right?
Copy code
<Button
        android:id="@+id/addJob_button"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_marginBottom="32dp"
        android:background="@drawable/round_button"
        android:backgroundTint="#FC7E2F"
        android:fontFamily="@font/montserrat_bold"
        android:text="upload job"
        android:textColor="#FFFFFF"
        android:textSize="18sp"
        android:textStyle="bold"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        tools:visibility="visible" />
Oh! Try setting it to an
AppCompatButton
instead of just a
Button
.
Specifically:
Copy code
<androidx.appcompat.widget.AppCompatButton
 ...
/>
j
Yay! Thank you so much! 😄
That solved the problem
r
That worked?
Awesome!
Yeah, this bit me once before, and it took forever to figure it out.