0

I am setting android:textColor but the text color is not changing. This is my fragment code. The background color changes but the text color remains black when I want white.

Edit: It is correct in the Design tab but not in the emulator.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/nav_bar_top_lin">

    <!-- Navigation -->

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/linLayFrag"
        android:layout_gravity="center_horizontal"
        android:background="@color/navColor">

        <Button
            android:layout_width="0dp"
            android:layout_weight=".25"
            android:background="@color/navColor"
            android:layout_height="wrap_content"
            android:onClick="goHome"
            android:textColor="@color/navTextColor"
            android:text="Home"
            android:id="@+id/homeButton" />

        <Button
            android:layout_width="0dp"
            android:layout_weight=".25"
            android:background="@color/navColor"
            android:layout_height="wrap_content"
            android:textColor="@color/navTextColor"
            android:onClick="goVault"
            android:text="Vault"
            android:id="@+id/vaultButton" />

        <Button
            android:layout_width="0dp"
            android:layout_weight=".25"
            android:background="@color/navColor"
            android:layout_height="wrap_content"
            android:onClick="goShop"
            android:textColor="@color/navTextColor"
            android:text="Shop"
            android:id="@+id/shopButton" />

        <Button
            android:layout_width="0dp"
            android:layout_weight=".25"
            android:background="@color/navColor"
            android:textColor="@color/navTextColor"
            android:layout_height="wrap_content"
            android:onClick="goAccount"
            android:text="Account"
            android:id="@+id/accInfoButton" />

    </LinearLayout>

    <!-- End Navigation -->

</LinearLayout>

This is my color resource.

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#3F51B5</color>
    <color name="colorPrimaryDark">#303F9F</color>
    <color name="colorAccent">#FF4081</color>
    <color name="textColor">#f5f5f9</color>
    <color name="horLine">#000000</color>
    <color name="navColor">#7b49c6</color>
    <color name="completeTaskColor">#158b11</color>
    <color name="navTextColor">#ffffff</color>
</resources>
CookieMonster
  • 492
  • 6
  • 18

1 Answers1

0

It's working perfectly fine on the emulator as well. Here's the screenshot -
enter image description here

Did u try it on a different emulator?

niranjan_b
  • 132
  • 5