2016-04-01 13 views
0

Meine app funktioniert perfekt, aber ich habe dieses Problem, dass meine Symbolleiste auf die Schaltfläche Farbänderungen in Version 21-22 zu black.Here das Beispiel ist, wie es aussieht normal: enter image description hereAndroid 21-22 Toolbar-Taste wird schwarz

und hier ist der problematischste Teil auf 21-22: enter image description here

hier ist meine Toolbar und mein Stil:

<?xml version="1.0" encoding="utf-8"?> 
<resources> 

    <!-- Base application theme. --> 
    <style name="AppTheme" parent="AppTheme.Base"> 

    </style> 

    <style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar"> 

     <!-- Customize your theme here. --> 
     <item name="colorPrimary">@color/colorPrimary</item> 
     <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
     <item name="colorAccent">@color/white</item> 
     <item name="android:windowTranslucentStatus">true</item> 

    </style> 

    <style name="CustomToolBarTheme" parent="ThemeOverlay.AppCompat.Light"> 

     <item name="android:textColorPrimary">@color/white</item> 
     <item name="android:textColorSecondary">@color/white</item> 
     <item name="colorAccent">@color/white</item> 
     <item name="android:windowTranslucentStatus">true</item> 

    </style> 

    <style name="Toolbar.TitleText" parent="TextAppearance.Widget.AppCompat.Toolbar.Title"> 
     <item name="android:textSize">18sp</item> 
    </style> 

</resources> 

die Symbolleiste:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="@color/colorPrimary" 
    android:paddingTop="@dimen/app_bar_top_padding" 
    app:theme="@style/CustomToolBarTheme"> 

    <TextView 
     android:id="@+id/toolbar_title" 
     android:layout_width="wrap_content" 
     android:maxLines="1" 
     android:layout_height="wrap_content" 
     android:textColor="@color/white" 
     android:textSize="19dp" /> 
</android.support.v7.widget.Toolbar> 

Ich habe versucht, die Farbe mit SpannableString ändern, aber es funktioniert nicht.

Antwort

0

Ich fand die Antwort, es ist in der Symbolleiste fügen Sie einfach das Thema und das PopupTheme wie in meinem Code und es wird funktionieren.Und Sie brauchen nicht, dass Stil und mehr:

<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="@color/colorPrimary" 
    android:paddingTop="@dimen/app_bar_top_padding" 
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"> 
0

Haben Sie versucht <item name="colorControlNormal">@color/colorwhatever</item> in Ihren Stilen? (Es sollte im ToolBar-Textstil sein)

+0

Immer noch nicht –

+0

Arbeits ich verstehe ... Lassen Sie mich nachdenken ... –

+0

Könnten Sie versuchen, mit @ color/yourtextcolor

Verwandte Themen