2016-09-18 6 views
0

Ich setze android:textColor, aber die Textfarbe ändert sich nicht. Das ist mein Fragmentcode. Die Hintergrundfarbe ändert sich, aber die Textfarbe bleibt schwarz, wenn ich weiß möchte.Android-Taste nicht einstellen Textfarbe

Edit: Es ist korrekt in der Design Registerkarte, aber nicht im 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> 

Dies ist meine Farbressource.

<?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> 
+0

es funktioniert gut. –

+0

http://stackoverflow.com/a/4692899/4450098. das könnte dir helfen –

Antwort

0

Es funktioniert auch perfekt auf dem Emulator. Hier ist der Screenshot -
enter image description here

Haben Sie es auf einem anderen Emulator versucht?