2017-08-05 1 views
-2

ich eine Symbolleiste ändern und wenn das Bild Scrollen mit Text zeigt, Ich versuche in Java auch toolbar.setTitleTextColor(Color.RED); Aber es funktioniert nicht die Textfarbe immer weißToolbar Textfarbe nicht

<android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      app:layout_collapseMode="pin" 
      app:titleTextColor="@color/buttontext" 
      app:popupTheme="@style/appBarTheme" /> 
+0

Dieser Link könnte Ihnen helfen. https://stackoverflow.com/questions/32237284/how-to-change-toolbar-color – user3678528

+0

'textColorSecondary' wird Ihnen helfen. Sehen Sie sich dazu auch [hier] an (https://stackoverflow.com/questions/39070040/textcolor-vs-textcolorprimary-vs-textcolorscondary) –

Antwort

0

hinzufügen Zu Stil .xml

<style name="ToolBarStyle" parent="Theme.AppCompat"> 
    <item name="android:textColorPrimary">@android:color/white</item> 
    <item name="android:textColorSecondary">@android:color/white</item> 
    <item name="actionMenuTextColor">@android:color/white</item> 
</style> 

und machen Sie Ihren Widget.Toolbal wie folgt aus:

<android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     app:theme="@style/ToolBarStyle" 
     android:layout_height="?attr/actionBarSize" 
    /> 

Sie können die Farbe in <item name="actionMenuTextColor">@android:color/white</item> in die gewünschte Farbe ändern.