2015-09-26 3 views
7

Meine Symbolleiste Text, Zurück Pfeil und alles kommt wie schwarz, aber ich will es weiß
Wie kann ich es erreichen?
Mein styles.xml sieht wie folgt aus:Android: Toolbar Text kommt als schwarz statt weiß

<resources> 

    <style name="AppTheme" parent="MyMaterialTheme.Base"> 

    </style> 

    <style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.NoActionBar"> 
     <item name="android:windowNoTitle">true</item> 
     <item name="windowActionBar">false</item> 
     <item name="colorPrimary">@color/colorPrimary</item> 
     <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
     <item name="colorAccent">@color/colorAccent</item> 
     <item name="android:windowBackground">@color/windowBackground</item> 
     <item name="android:textColor">@color/textColorPrimary</item> 
     <item name="android:textStyle">normal</item> 



    </style> 


</resources> 

Android Manifest Snippet:

<application 
     android:allowBackup="true" 
     android:icon="@mipmap/hello" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 
+0

möglich Duplikat [Android Theme.AppCompat.Light mit Dark Toolbar (für Licht Text)] (http: // Stackoverflow .com/questions/27551230/android-theme-appcompat-licht-mit-dunkel-toolbar-für-licht-text) –

Antwort

15

definieren einen Stil für die Symbolleiste:

<style name="AppToolbar" parent="ThemeOverlay.AppCompat.Dark.ActionBar"> 
    <item name="android:textColorPrimary">@android:color/white</item> 
    <item name="android:textColorSecondary">@android:color/white</item> 
</style> 

Set es zu Ihrer Symbolleiste:

<android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:layout_scrollFlags="scroll|enterAlways" 
     android:theme="@style/AppToolbar" 
     android:minHeight="?attr/actionBarSize"/> 
1

this answer here

Um beziehen sich einfach die Farbe des Titels in Ihrer Toolbar Sie zu ändern müssen Sie das Attribut android:textColorPrimary zu Ihrer Toolbar hinzufügen.

1

Versuchen in Ihrem themes.xml diese diese Elemente zu verwenden oder styles.xml in Werte Ordner oder Werte-v21 und andere Werte-Ordner.

<style name="AppTheme" parent="Theme.AppCompat.Light"> 
     <!-- Customize your theme here. --> 
     <item name="colorPrimary">@color/primaryColor</item> 
     <item name="colorPrimaryDark">@color/primaryColor</item> 
     <item name="colorAccent">@color/primaryColor</item> 
     <item name="android:textColorPrimary">@android:color/white</item> 
     <item name="android:navigationBarColor">@android:color/black</item> 

     <item name="actionMenuTextColor">@android:color/holo_blue_dark</item> 
     <item name="android:actionMenuTextColor">@android:color/holo_blue_dark</item> 
     <item name="android:windowDrawsSystemBarBackgrounds">true</item> 
     <item name="android:statusBarColor">@android:color/black</item> 
     <item name="windowActionBar">false</item> 
     <item name="windowNoTitle">true</item> 
     <item name="android:windowBackground">@android:color/white</item> 
     <item name="android:windowContentTransitions">true</item> 
     </style> 

Hinweis: - entfernen Sie diese Elemente von unten API-Ebene 21.

 <item name="android:windowDrawsSystemBarBackgrounds">true</item> 
     <item name="android:statusBarColor">@android:color/black</item> 
     <item name="android:windowContentTransitions">true</item> 
Verwandte Themen