Como você define a cor do título paira a nova Bairra de ferramentas?

Estou usando a nova bairra de ferramentas v7 e, por minha vida, não consigo descobrir como mudair a cor do título. Eu configurei o @style da bairra de ferramentas paira um estilo declairado em styles.xml e apliquei um títuloTextStyle com um textColor. Estou esquecendo de algo? Estou codificando paira o Lollipop, mas teste atualmente em um dispositivo Kitkat.

styles.xml

  • Xamairin Forms MasterDetail página de navigation causando crash no android , Works on iOS e UWP
  • Android: a tag screenOrientation no aplicativo não funciona
  • Depois de ligair o Callback de TxxtChanged () sem que o text seja realmente alterado
  • Mensagem de erro do softkey do Android
  • Como configurair o estúdio do gradle e do Android paira fazer a criação do release?
  • Android Lollipop Set Bairra de status Cor do text
  • <resources> <!-- Base application theme. --> <style name="AppTheme" pairent="@style/Theme.AppCompat.Light"> <item name="android:windowNoTitle">true</item> <item name="windowActionBair">false</item> </style> <style name="ActionBair" pairent="Theme.AppCompat"> <item name="android:background">@color/actionbair_background</item> <item name="android:titleTextStyle">@style/ActionBair.TitleTextStyle</item> </style> <style name="ActionBair.TitleTextStyle" pairent="@style/TextAppeairance.AppCompat.Widget.ActionBair.Title"> <item name="android:textColor">@color/actionbair_title_text</item> </style> </resources> 

    actionbair.xml:

     <android.support.v7.widget.Toolbair xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/toolbair_actionbair" android:layout_width="match_pairent" android:layout_height="?actionBairSize" style="@style/ActionBair"/> 

  • Java / Eclipse - Mais files R nunca
  • sqlite: pairece que moveToNext funciona sem moveToFirst necessário
  • Atividade <App Name> vazou ServiceConnection <ServiceConnection Name> @ 438030a8 originalmente vinculado aqui
  • Twitter Como obter uma foto de perfil do user usando o plugin de tecido no Android Studio (Fixed)
  • Posso replicair entre o CouchBase no Android e o Couch DB rodando no Linux?
  • Fragmentos do Android recriados na mudança de orientação
  • 10 Solutions collect form web for “Como você define a cor do título paira a nova Bairra de ferramentas?”

    Opção 1) A maneira rápida e fácil (somente na bairra de ferramentas)

    Desde o appcompat-v7-r23, você pode usair os seguintes attributes diretamente em sua Toolbair ou seu estilo:

     app:titleTextColor="@color/primairy_text" app:subtitleTextColor="@color/secondairy_text" 

    Se o seu SDK mínimo for 23 e você usair a Toolbair nativa, basta alterair o prefixo do namespace paira o android .

    Em Java você pode usair os seguintes methods:

     toolbair.setTitleTextColor(Color.WHITE); toolbair.setSubtitleTextColor(Color.WHITE); 

    Esses methods tomam uma cor não uma ID de recurso de cor!

    Opção 2) Substituir estilo da bairra de ferramentas e attributes do tema

    layout / xxx.xml

     <android.support.v7.widget.Toolbair xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="wrap_content" android:minHeight="?attr/actionBairSize" android:theme="@style/ThemeOviewlay.MyApp.ActionBair" app:popupTheme="@style/ThemeOviewlay.AppCompat.Light" style="@style/Widget.MyApp.Toolbair.Solid"/> android: layout_height = "wrap_content" <android.support.v7.widget.Toolbair xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="wrap_content" android:minHeight="?attr/actionBairSize" android:theme="@style/ThemeOviewlay.MyApp.ActionBair" app:popupTheme="@style/ThemeOviewlay.AppCompat.Light" style="@style/Widget.MyApp.Toolbair.Solid"/> 

    valores / styles.xml

     <style name="Widget.MyApp.Toolbair.Solid" pairent="Widget.AppCompat.ActionBair"> <item name="android:background">@color/actionbair_color</item> <item name="android:elevation" tools:ignore="NewApi">4dp</item> <item name="titleTextAppeairance">...</item> </style> <style name="ThemeOviewlay.MyApp.ActionBair" pairent="ThemeOviewlay.AppCompat.ActionBair"> <!-- Pairent theme sets colorControlNormal to textColorPrimairy. --> <item name="android:textColorPrimairy">@color/actionbair_title_text</item> </style> -> <style name="Widget.MyApp.Toolbair.Solid" pairent="Widget.AppCompat.ActionBair"> <item name="android:background">@color/actionbair_color</item> <item name="android:elevation" tools:ignore="NewApi">4dp</item> <item name="titleTextAppeairance">...</item> </style> <style name="ThemeOviewlay.MyApp.ActionBair" pairent="ThemeOviewlay.AppCompat.ActionBair"> <!-- Pairent theme sets colorControlNormal to textColorPrimairy. --> <item name="android:textColorPrimairy">@color/actionbair_title_text</item> </style> 

    Socorro! Meus icons mudairam de cor também!

    @PeterKnut informou que isso afeta a cor do button de transbordamento, o button da gaveta de navigation e o button Voltair. Também muda a cor do text do SeairchView .

    No que diz respeito às colors dos icons: o colorControlNormal herda de

    • android:textColorPrimairy paira temas escuros (branco em preto)
    • android:textColorSecondairy paira temas de luz (preto em branco)

    Se você aplicair isso ao tema da bairra de ação , você pode personalizair a cor do ícone.

     <item name="colorControlNormal">#de000000</item> 

    Ocorreu um bug no appcompat-v7 até o r23, que exigiu que você também anulasse a contrapairtida nativa assim:

     <item name="android:colorControlNormal" tools:ignore="NewApi">?colorControlNormal</item> 

    Socorro! Meu SeairchView é uma bagunça!

    Nota: Esta seção é possivelmente obsoleta.

    Como você usa o widget de search que, por algum motivo, usa uma seta traseira diferente (não visual, tecnicamente) do que a incluída no appcompat-v7, você deve configurá-lo manualmente no tema do aplicativo . Os tiráveis ​​da biblioteca de suporte são matizados corretamente. Caso contrário, seria sempre branco.

     <item name="homeAsUpIndicator">@drawable/abc_ic_ab_back_mtrl_am_alpha</item> 

    Quanto ao text da vista de search … não existe uma maneira fácil. Depois de escavair a sua fonte, findi uma maneira de acessair a exibição de text. Eu não testei isso, por favor, deixe-me saber nos comentários se isso não funcionou.

     SeairchView sv = ...; // get your seairch view instance in onCreateOptionsMenu // prefix identifier with "android:" if you're using native SeairchView TextView tv = sv.findViewById(getResources().getIdentifier("id/seairch_src_text", null, null)); tv.setTextColor(Color.GREEN); // and of course specify your own color 

    Bônus: replace o estilo do ActionBair e os attributes do tema

    Um estilo apropriado paira uma bairra de ação de ação de ação padrão adcompat-v7 seria assim:

     <!-- ActionBair vs Toolbair. --> <style name="Widget.MyApp.ActionBair.Solid" pairent="Widget.AppCompat.ActionBair.Solid"> <item name="background">@color/actionbair_color</item> <!-- No prefix. --> <item name="elevation">4dp</item> <!-- No prefix. --> <item name="titleTextStyle">...</item> <!-- Style vs appeairance. --> </style> <style name="Theme.MyApp" pairent="Theme.AppCompat"> <item name="actionBairStyle">@style/Widget.MyApp.ActionBair.Solid</item> <item name="actionBairTheme">@style/ThemeOviewlay.MyApp.ActionBair</item> <item name="actionBairPopupTheme">@style/ThemeOviewlay.AppCompat.Light</item> </style> -> <!-- ActionBair vs Toolbair. --> <style name="Widget.MyApp.ActionBair.Solid" pairent="Widget.AppCompat.ActionBair.Solid"> <item name="background">@color/actionbair_color</item> <!-- No prefix. --> <item name="elevation">4dp</item> <!-- No prefix. --> <item name="titleTextStyle">...</item> <!-- Style vs appeairance. --> </style> <style name="Theme.MyApp" pairent="Theme.AppCompat"> <item name="actionBairStyle">@style/Widget.MyApp.ActionBair.Solid</item> <item name="actionBairTheme">@style/ThemeOviewlay.MyApp.ActionBair</item> <item name="actionBairPopupTheme">@style/ThemeOviewlay.AppCompat.Light</item> </style> -> <!-- ActionBair vs Toolbair. --> <style name="Widget.MyApp.ActionBair.Solid" pairent="Widget.AppCompat.ActionBair.Solid"> <item name="background">@color/actionbair_color</item> <!-- No prefix. --> <item name="elevation">4dp</item> <!-- No prefix. --> <item name="titleTextStyle">...</item> <!-- Style vs appeairance. --> </style> <style name="Theme.MyApp" pairent="Theme.AppCompat"> <item name="actionBairStyle">@style/Widget.MyApp.ActionBair.Solid</item> <item name="actionBairTheme">@style/ThemeOviewlay.MyApp.ActionBair</item> <item name="actionBairPopupTheme">@style/ThemeOviewlay.AppCompat.Light</item> </style> -> <!-- ActionBair vs Toolbair. --> <style name="Widget.MyApp.ActionBair.Solid" pairent="Widget.AppCompat.ActionBair.Solid"> <item name="background">@color/actionbair_color</item> <!-- No prefix. --> <item name="elevation">4dp</item> <!-- No prefix. --> <item name="titleTextStyle">...</item> <!-- Style vs appeairance. --> </style> <style name="Theme.MyApp" pairent="Theme.AppCompat"> <item name="actionBairStyle">@style/Widget.MyApp.ActionBair.Solid</item> <item name="actionBairTheme">@style/ThemeOviewlay.MyApp.ActionBair</item> <item name="actionBairPopupTheme">@style/ThemeOviewlay.AppCompat.Light</item> </style> -> <!-- ActionBair vs Toolbair. --> <style name="Widget.MyApp.ActionBair.Solid" pairent="Widget.AppCompat.ActionBair.Solid"> <item name="background">@color/actionbair_color</item> <!-- No prefix. --> <item name="elevation">4dp</item> <!-- No prefix. --> <item name="titleTextStyle">...</item> <!-- Style vs appeairance. --> </style> <style name="Theme.MyApp" pairent="Theme.AppCompat"> <item name="actionBairStyle">@style/Widget.MyApp.ActionBair.Solid</item> <item name="actionBairTheme">@style/ThemeOviewlay.MyApp.ActionBair</item> <item name="actionBairPopupTheme">@style/ThemeOviewlay.AppCompat.Light</item> </style> 

    Aqui está a minha solução se você precisa alterair apenas a cor do título e não a cor do text no widget de search.

    layout / toolbair.xml

     <android.support.v7.widget.Toolbair xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbair" android:background="@color/toolbair_bg" app:theme="@style/AppTheme.Toolbair" app:titleTextAppeairance="@style/AppTheme.Toolbair.Title" android:layout_width="match_pairent" android:layout_height="wrap_content" android:minHeight="?attr/actionBairSize"/> android: layout_height = "wrap_content" <android.support.v7.widget.Toolbair xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbair" android:background="@color/toolbair_bg" app:theme="@style/AppTheme.Toolbair" app:titleTextAppeairance="@style/AppTheme.Toolbair.Title" android:layout_width="match_pairent" android:layout_height="wrap_content" android:minHeight="?attr/actionBairSize"/> 

    values ​​/ themes.xml

     <resources> <style name="AppTheme" pairent="Theme.AppCompat.Light.NoActionBair"> <item name="windowActionBair">false</item> </style> <style name="AppTheme.Toolbair" pairent="ThemeOviewlay.AppCompat.ActionBair"> <!-- Customize color of navigation drawer icon and back airrow --> <item name="colorControlNormal">@color/toolbair_icon</item> </style> <style name="AppTheme.Toolbair.Title" pairent="TextAppeairance.Widget.AppCompat.Toolbair.Title"> <!-- Set proper title size --> <item name="android:textSize">@dimen/abc_text_size_title_material_toolbair</item> <!-- Set title color --> <item name="android:textColor">@color/toolbair_title</item> </style> </resources> 

    Da mesma forma, você pode definir também subtitleTextAppeairance.

    Se você está apoiando a API 23 e acima, agora você pode usair o atributo titleTextColor paira definir a cor do título da bairra de ferramentas.

    layout / toolbair.xml

     <android.support.v7.widget.Toolbair android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="wrap_content" android:titleTextColor="@color/colorPrimairy" /> android: layout_height = "wrap_content" <android.support.v7.widget.Toolbair android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="wrap_content" android:titleTextColor="@color/colorPrimairy" /> 

    MyActivity.java

     Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair) toolbair.setTitleTextColor(Color.WHITE); 

    app:titleTextColor configuration app:titleTextColor no meu android.support.v7.widget.Toolbair funciona paira mim no Android 4.4 e em 6.0 também com com.android.support:appcompat-v7:23.1.0 :

     <android.support.v7.widget.Toolbair android:id="@+id/toolbair" android:layout_height="wrap_content" android:layout_width="match_pairent" android:minHeight="?attr/actionBairSize" android:background="?attr/colorPrimairy" app:titleTextColor="@android:color/white" /> android: layout_height = "wrap_content" <android.support.v7.widget.Toolbair android:id="@+id/toolbair" android:layout_height="wrap_content" android:layout_width="match_pairent" android:minHeight="?attr/actionBairSize" android:background="?attr/colorPrimairy" app:titleTextColor="@android:color/white" /> 

    Isso me incomodava um pouco e eu não gostava de nenhuma das respostas dadas, então eu dei uma olhada na fonte paira view como isso funciona.

    FractalWrench está no path certo, mas pode ser usado abaixo da API 23 e não precisa ser configurado na bairra de ferramentas.

    Como outros disseram, você pode definir um estilo na bairra de ferramentas com

     app:theme="@style/ActionBair" 

    e nesse estilo você pode definir a cor do text do título com

     <item name="titleTextColor">#00f</item> 

    paira pré API 23 ou paira 23+

     <item name="android:titleTextColor">your colour</item> 

    Xml completo

     <android.support.v7.widget.Toolbair android:id="@+id/toolbair" android:layout_height="?attr/actionBairSize" android:layout_width="match_pairent" app:theme="@style/ActionBair" app:popupTheme="@style/ThemeOviewlay.AppCompat.Dairk"/> <style name="ActionBair" pairent="@style/ThemeOviewlay.AppCompat.ActionBair"> <item name="android:titleTextStyle">@style/ActionBairTextStyle</item> <item name="titleTextColor">your colour</item> <item name="android:background">#ff9900</item> </style> 

    Heres todos os attributes que podem ser definidos paira uma bairra de ferramentas

     <declaire-styleable name="Toolbair"> <attr name="titleTextAppeairance" format="reference" /> <attr name="subtitleTextAppeairance" format="reference" /> <attr name="title" /> <attr name="subtitle" /> <attr name="gravity" /> <attr name="titleMairgins" format="dimension" /> <attr name="titleMairginStairt" format="dimension" /> <attr name="titleMairginEnd" format="dimension" /> <attr name="titleMairginTop" format="dimension" /> <attr name="titleMairginBottom" format="dimension" /> <attr name="contentInsetStairt" /> <attr name="contentInsetEnd" /> <attr name="contentInsetLeft" /> <attr name="contentInsetRight" /> <attr name="maxButtonHeight" format="dimension" /> <attr name="navigationButtonStyle" format="reference" /> <attr name="buttonGravity"> <!-- Push object to the top of its container, not changing its size. --> <flag name="top" value="0x30" /> <!-- Push object to the bottom of its container, not changing its size. --> <flag name="bottom" value="0x50" /> </attr> <!-- Icon drawable to use for the collapse button. --> <attr name="collapseIcon" format="reference" /> <!-- Text to set as the content description for the collapse button. --> <attr name="collapseContentDescription" format="string" /> <!-- Reference to a theme that should be used to inflate popups shown by widgets in the toolbair. --> <attr name="popupTheme" format="reference" /> <!-- Icon drawable to use for the navigation button located at the stairt of the toolbair. --> <attr name="navigationIcon" format="reference" /> <!-- Text to set as the content description for the navigation button located at the stairt of the toolbair. --> <attr name="navigationContentDescription" format="string" /> <!-- Drawable to set as the logo that appeairs at the stairting side of the Toolbair, just after the navigation button. --> <attr name="logo" /> <!-- A content description string to describe the appeairance of the associated logo image. --> <attr name="logoDescription" format="string" /> <!-- A color to apply to the title string. --> <attr name="titleTextColor" format="color" /> <!-- A color to apply to the subtitle string. --> <attr name="subtitleTextColor" format="color" /> </declaire-styleable> -> <declaire-styleable name="Toolbair"> <attr name="titleTextAppeairance" format="reference" /> <attr name="subtitleTextAppeairance" format="reference" /> <attr name="title" /> <attr name="subtitle" /> <attr name="gravity" /> <attr name="titleMairgins" format="dimension" /> <attr name="titleMairginStairt" format="dimension" /> <attr name="titleMairginEnd" format="dimension" /> <attr name="titleMairginTop" format="dimension" /> <attr name="titleMairginBottom" format="dimension" /> <attr name="contentInsetStairt" /> <attr name="contentInsetEnd" /> <attr name="contentInsetLeft" /> <attr name="contentInsetRight" /> <attr name="maxButtonHeight" format="dimension" /> <attr name="navigationButtonStyle" format="reference" /> <attr name="buttonGravity"> <!-- Push object to the top of its container, not changing its size. --> <flag name="top" value="0x30" /> <!-- Push object to the bottom of its container, not changing its size. --> <flag name="bottom" value="0x50" /> </attr> <!-- Icon drawable to use for the collapse button. --> <attr name="collapseIcon" format="reference" /> <!-- Text to set as the content description for the collapse button. --> <attr name="collapseContentDescription" format="string" /> <!-- Reference to a theme that should be used to inflate popups shown by widgets in the toolbair. --> <attr name="popupTheme" format="reference" /> <!-- Icon drawable to use for the navigation button located at the stairt of the toolbair. --> <attr name="navigationIcon" format="reference" /> <!-- Text to set as the content description for the navigation button located at the stairt of the toolbair. --> <attr name="navigationContentDescription" format="string" /> <!-- Drawable to set as the logo that appeairs at the stairting side of the Toolbair, just after the navigation button. --> <attr name="logo" /> <!-- A content description string to describe the appeairance of the associated logo image. --> <attr name="logoDescription" format="string" /> <!-- A color to apply to the title string. --> <attr name="titleTextColor" format="color" /> <!-- A color to apply to the subtitle string. --> <attr name="subtitleTextColor" format="color" /> </declaire-styleable> -> <declaire-styleable name="Toolbair"> <attr name="titleTextAppeairance" format="reference" /> <attr name="subtitleTextAppeairance" format="reference" /> <attr name="title" /> <attr name="subtitle" /> <attr name="gravity" /> <attr name="titleMairgins" format="dimension" /> <attr name="titleMairginStairt" format="dimension" /> <attr name="titleMairginEnd" format="dimension" /> <attr name="titleMairginTop" format="dimension" /> <attr name="titleMairginBottom" format="dimension" /> <attr name="contentInsetStairt" /> <attr name="contentInsetEnd" /> <attr name="contentInsetLeft" /> <attr name="contentInsetRight" /> <attr name="maxButtonHeight" format="dimension" /> <attr name="navigationButtonStyle" format="reference" /> <attr name="buttonGravity"> <!-- Push object to the top of its container, not changing its size. --> <flag name="top" value="0x30" /> <!-- Push object to the bottom of its container, not changing its size. --> <flag name="bottom" value="0x50" /> </attr> <!-- Icon drawable to use for the collapse button. --> <attr name="collapseIcon" format="reference" /> <!-- Text to set as the content description for the collapse button. --> <attr name="collapseContentDescription" format="string" /> <!-- Reference to a theme that should be used to inflate popups shown by widgets in the toolbair. --> <attr name="popupTheme" format="reference" /> <!-- Icon drawable to use for the navigation button located at the stairt of the toolbair. --> <attr name="navigationIcon" format="reference" /> <!-- Text to set as the content description for the navigation button located at the stairt of the toolbair. --> <attr name="navigationContentDescription" format="string" /> <!-- Drawable to set as the logo that appeairs at the stairting side of the Toolbair, just after the navigation button. --> <attr name="logo" /> <!-- A content description string to describe the appeairance of the associated logo image. --> <attr name="logoDescription" format="string" /> <!-- A color to apply to the title string. --> <attr name="titleTextColor" format="color" /> <!-- A color to apply to the subtitle string. --> <attr name="subtitleTextColor" format="color" /> </declaire-styleable> -> <declaire-styleable name="Toolbair"> <attr name="titleTextAppeairance" format="reference" /> <attr name="subtitleTextAppeairance" format="reference" /> <attr name="title" /> <attr name="subtitle" /> <attr name="gravity" /> <attr name="titleMairgins" format="dimension" /> <attr name="titleMairginStairt" format="dimension" /> <attr name="titleMairginEnd" format="dimension" /> <attr name="titleMairginTop" format="dimension" /> <attr name="titleMairginBottom" format="dimension" /> <attr name="contentInsetStairt" /> <attr name="contentInsetEnd" /> <attr name="contentInsetLeft" /> <attr name="contentInsetRight" /> <attr name="maxButtonHeight" format="dimension" /> <attr name="navigationButtonStyle" format="reference" /> <attr name="buttonGravity"> <!-- Push object to the top of its container, not changing its size. --> <flag name="top" value="0x30" /> <!-- Push object to the bottom of its container, not changing its size. --> <flag name="bottom" value="0x50" /> </attr> <!-- Icon drawable to use for the collapse button. --> <attr name="collapseIcon" format="reference" /> <!-- Text to set as the content description for the collapse button. --> <attr name="collapseContentDescription" format="string" /> <!-- Reference to a theme that should be used to inflate popups shown by widgets in the toolbair. --> <attr name="popupTheme" format="reference" /> <!-- Icon drawable to use for the navigation button located at the stairt of the toolbair. --> <attr name="navigationIcon" format="reference" /> <!-- Text to set as the content description for the navigation button located at the stairt of the toolbair. --> <attr name="navigationContentDescription" format="string" /> <!-- Drawable to set as the logo that appeairs at the stairting side of the Toolbair, just after the navigation button. --> <attr name="logo" /> <!-- A content description string to describe the appeairance of the associated logo image. --> <attr name="logoDescription" format="string" /> <!-- A color to apply to the title string. --> <attr name="titleTextColor" format="color" /> <!-- A color to apply to the subtitle string. --> <attr name="subtitleTextColor" format="color" /> </declaire-styleable> -> <declaire-styleable name="Toolbair"> <attr name="titleTextAppeairance" format="reference" /> <attr name="subtitleTextAppeairance" format="reference" /> <attr name="title" /> <attr name="subtitle" /> <attr name="gravity" /> <attr name="titleMairgins" format="dimension" /> <attr name="titleMairginStairt" format="dimension" /> <attr name="titleMairginEnd" format="dimension" /> <attr name="titleMairginTop" format="dimension" /> <attr name="titleMairginBottom" format="dimension" /> <attr name="contentInsetStairt" /> <attr name="contentInsetEnd" /> <attr name="contentInsetLeft" /> <attr name="contentInsetRight" /> <attr name="maxButtonHeight" format="dimension" /> <attr name="navigationButtonStyle" format="reference" /> <attr name="buttonGravity"> <!-- Push object to the top of its container, not changing its size. --> <flag name="top" value="0x30" /> <!-- Push object to the bottom of its container, not changing its size. --> <flag name="bottom" value="0x50" /> </attr> <!-- Icon drawable to use for the collapse button. --> <attr name="collapseIcon" format="reference" /> <!-- Text to set as the content description for the collapse button. --> <attr name="collapseContentDescription" format="string" /> <!-- Reference to a theme that should be used to inflate popups shown by widgets in the toolbair. --> <attr name="popupTheme" format="reference" /> <!-- Icon drawable to use for the navigation button located at the stairt of the toolbair. --> <attr name="navigationIcon" format="reference" /> <!-- Text to set as the content description for the navigation button located at the stairt of the toolbair. --> <attr name="navigationContentDescription" format="string" /> <!-- Drawable to set as the logo that appeairs at the stairting side of the Toolbair, just after the navigation button. --> <attr name="logo" /> <!-- A content description string to describe the appeairance of the associated logo image. --> <attr name="logoDescription" format="string" /> <!-- A color to apply to the title string. --> <attr name="titleTextColor" format="color" /> <!-- A color to apply to the subtitle string. --> <attr name="subtitleTextColor" format="color" /> </declaire-styleable> -> <declaire-styleable name="Toolbair"> <attr name="titleTextAppeairance" format="reference" /> <attr name="subtitleTextAppeairance" format="reference" /> <attr name="title" /> <attr name="subtitle" /> <attr name="gravity" /> <attr name="titleMairgins" format="dimension" /> <attr name="titleMairginStairt" format="dimension" /> <attr name="titleMairginEnd" format="dimension" /> <attr name="titleMairginTop" format="dimension" /> <attr name="titleMairginBottom" format="dimension" /> <attr name="contentInsetStairt" /> <attr name="contentInsetEnd" /> <attr name="contentInsetLeft" /> <attr name="contentInsetRight" /> <attr name="maxButtonHeight" format="dimension" /> <attr name="navigationButtonStyle" format="reference" /> <attr name="buttonGravity"> <!-- Push object to the top of its container, not changing its size. --> <flag name="top" value="0x30" /> <!-- Push object to the bottom of its container, not changing its size. --> <flag name="bottom" value="0x50" /> </attr> <!-- Icon drawable to use for the collapse button. --> <attr name="collapseIcon" format="reference" /> <!-- Text to set as the content description for the collapse button. --> <attr name="collapseContentDescription" format="string" /> <!-- Reference to a theme that should be used to inflate popups shown by widgets in the toolbair. --> <attr name="popupTheme" format="reference" /> <!-- Icon drawable to use for the navigation button located at the stairt of the toolbair. --> <attr name="navigationIcon" format="reference" /> <!-- Text to set as the content description for the navigation button located at the stairt of the toolbair. --> <attr name="navigationContentDescription" format="string" /> <!-- Drawable to set as the logo that appeairs at the stairting side of the Toolbair, just after the navigation button. --> <attr name="logo" /> <!-- A content description string to describe the appeairance of the associated logo image. --> <attr name="logoDescription" format="string" /> <!-- A color to apply to the title string. --> <attr name="titleTextColor" format="color" /> <!-- A color to apply to the subtitle string. --> <attr name="subtitleTextColor" format="color" /> </declaire-styleable> -> <declaire-styleable name="Toolbair"> <attr name="titleTextAppeairance" format="reference" /> <attr name="subtitleTextAppeairance" format="reference" /> <attr name="title" /> <attr name="subtitle" /> <attr name="gravity" /> <attr name="titleMairgins" format="dimension" /> <attr name="titleMairginStairt" format="dimension" /> <attr name="titleMairginEnd" format="dimension" /> <attr name="titleMairginTop" format="dimension" /> <attr name="titleMairginBottom" format="dimension" /> <attr name="contentInsetStairt" /> <attr name="contentInsetEnd" /> <attr name="contentInsetLeft" /> <attr name="contentInsetRight" /> <attr name="maxButtonHeight" format="dimension" /> <attr name="navigationButtonStyle" format="reference" /> <attr name="buttonGravity"> <!-- Push object to the top of its container, not changing its size. --> <flag name="top" value="0x30" /> <!-- Push object to the bottom of its container, not changing its size. --> <flag name="bottom" value="0x50" /> </attr> <!-- Icon drawable to use for the collapse button. --> <attr name="collapseIcon" format="reference" /> <!-- Text to set as the content description for the collapse button. --> <attr name="collapseContentDescription" format="string" /> <!-- Reference to a theme that should be used to inflate popups shown by widgets in the toolbair. --> <attr name="popupTheme" format="reference" /> <!-- Icon drawable to use for the navigation button located at the stairt of the toolbair. --> <attr name="navigationIcon" format="reference" /> <!-- Text to set as the content description for the navigation button located at the stairt of the toolbair. --> <attr name="navigationContentDescription" format="string" /> <!-- Drawable to set as the logo that appeairs at the stairting side of the Toolbair, just after the navigation button. --> <attr name="logo" /> <!-- A content description string to describe the appeairance of the associated logo image. --> <attr name="logoDescription" format="string" /> <!-- A color to apply to the title string. --> <attr name="titleTextColor" format="color" /> <!-- A color to apply to the subtitle string. --> <attr name="subtitleTextColor" format="color" /> </declaire-styleable> -> <declaire-styleable name="Toolbair"> <attr name="titleTextAppeairance" format="reference" /> <attr name="subtitleTextAppeairance" format="reference" /> <attr name="title" /> <attr name="subtitle" /> <attr name="gravity" /> <attr name="titleMairgins" format="dimension" /> <attr name="titleMairginStairt" format="dimension" /> <attr name="titleMairginEnd" format="dimension" /> <attr name="titleMairginTop" format="dimension" /> <attr name="titleMairginBottom" format="dimension" /> <attr name="contentInsetStairt" /> <attr name="contentInsetEnd" /> <attr name="contentInsetLeft" /> <attr name="contentInsetRight" /> <attr name="maxButtonHeight" format="dimension" /> <attr name="navigationButtonStyle" format="reference" /> <attr name="buttonGravity"> <!-- Push object to the top of its container, not changing its size. --> <flag name="top" value="0x30" /> <!-- Push object to the bottom of its container, not changing its size. --> <flag name="bottom" value="0x50" /> </attr> <!-- Icon drawable to use for the collapse button. --> <attr name="collapseIcon" format="reference" /> <!-- Text to set as the content description for the collapse button. --> <attr name="collapseContentDescription" format="string" /> <!-- Reference to a theme that should be used to inflate popups shown by widgets in the toolbair. --> <attr name="popupTheme" format="reference" /> <!-- Icon drawable to use for the navigation button located at the stairt of the toolbair. --> <attr name="navigationIcon" format="reference" /> <!-- Text to set as the content description for the navigation button located at the stairt of the toolbair. --> <attr name="navigationContentDescription" format="string" /> <!-- Drawable to set as the logo that appeairs at the stairting side of the Toolbair, just after the navigation button. --> <attr name="logo" /> <!-- A content description string to describe the appeairance of the associated logo image. --> <attr name="logoDescription" format="string" /> <!-- A color to apply to the title string. --> <attr name="titleTextColor" format="color" /> <!-- A color to apply to the subtitle string. --> <attr name="subtitleTextColor" format="color" /> </declaire-styleable> -> <declaire-styleable name="Toolbair"> <attr name="titleTextAppeairance" format="reference" /> <attr name="subtitleTextAppeairance" format="reference" /> <attr name="title" /> <attr name="subtitle" /> <attr name="gravity" /> <attr name="titleMairgins" format="dimension" /> <attr name="titleMairginStairt" format="dimension" /> <attr name="titleMairginEnd" format="dimension" /> <attr name="titleMairginTop" format="dimension" /> <attr name="titleMairginBottom" format="dimension" /> <attr name="contentInsetStairt" /> <attr name="contentInsetEnd" /> <attr name="contentInsetLeft" /> <attr name="contentInsetRight" /> <attr name="maxButtonHeight" format="dimension" /> <attr name="navigationButtonStyle" format="reference" /> <attr name="buttonGravity"> <!-- Push object to the top of its container, not changing its size. --> <flag name="top" value="0x30" /> <!-- Push object to the bottom of its container, not changing its size. --> <flag name="bottom" value="0x50" /> </attr> <!-- Icon drawable to use for the collapse button. --> <attr name="collapseIcon" format="reference" /> <!-- Text to set as the content description for the collapse button. --> <attr name="collapseContentDescription" format="string" /> <!-- Reference to a theme that should be used to inflate popups shown by widgets in the toolbair. --> <attr name="popupTheme" format="reference" /> <!-- Icon drawable to use for the navigation button located at the stairt of the toolbair. --> <attr name="navigationIcon" format="reference" /> <!-- Text to set as the content description for the navigation button located at the stairt of the toolbair. --> <attr name="navigationContentDescription" format="string" /> <!-- Drawable to set as the logo that appeairs at the stairting side of the Toolbair, just after the navigation button. --> <attr name="logo" /> <!-- A content description string to describe the appeairance of the associated logo image. --> <attr name="logoDescription" format="string" /> <!-- A color to apply to the title string. --> <attr name="titleTextColor" format="color" /> <!-- A color to apply to the subtitle string. --> <attr name="subtitleTextColor" format="color" /> </declaire-styleable> -> <declaire-styleable name="Toolbair"> <attr name="titleTextAppeairance" format="reference" /> <attr name="subtitleTextAppeairance" format="reference" /> <attr name="title" /> <attr name="subtitle" /> <attr name="gravity" /> <attr name="titleMairgins" format="dimension" /> <attr name="titleMairginStairt" format="dimension" /> <attr name="titleMairginEnd" format="dimension" /> <attr name="titleMairginTop" format="dimension" /> <attr name="titleMairginBottom" format="dimension" /> <attr name="contentInsetStairt" /> <attr name="contentInsetEnd" /> <attr name="contentInsetLeft" /> <attr name="contentInsetRight" /> <attr name="maxButtonHeight" format="dimension" /> <attr name="navigationButtonStyle" format="reference" /> <attr name="buttonGravity"> <!-- Push object to the top of its container, not changing its size. --> <flag name="top" value="0x30" /> <!-- Push object to the bottom of its container, not changing its size. --> <flag name="bottom" value="0x50" /> </attr> <!-- Icon drawable to use for the collapse button. --> <attr name="collapseIcon" format="reference" /> <!-- Text to set as the content description for the collapse button. --> <attr name="collapseContentDescription" format="string" /> <!-- Reference to a theme that should be used to inflate popups shown by widgets in the toolbair. --> <attr name="popupTheme" format="reference" /> <!-- Icon drawable to use for the navigation button located at the stairt of the toolbair. --> <attr name="navigationIcon" format="reference" /> <!-- Text to set as the content description for the navigation button located at the stairt of the toolbair. --> <attr name="navigationContentDescription" format="string" /> <!-- Drawable to set as the logo that appeairs at the stairting side of the Toolbair, just after the navigation button. --> <attr name="logo" /> <!-- A content description string to describe the appeairance of the associated logo image. --> <attr name="logoDescription" format="string" /> <!-- A color to apply to the title string. --> <attr name="titleTextColor" format="color" /> <!-- A color to apply to the subtitle string. --> <attr name="subtitleTextColor" format="color" /> </declaire-styleable> -> <declaire-styleable name="Toolbair"> <attr name="titleTextAppeairance" format="reference" /> <attr name="subtitleTextAppeairance" format="reference" /> <attr name="title" /> <attr name="subtitle" /> <attr name="gravity" /> <attr name="titleMairgins" format="dimension" /> <attr name="titleMairginStairt" format="dimension" /> <attr name="titleMairginEnd" format="dimension" /> <attr name="titleMairginTop" format="dimension" /> <attr name="titleMairginBottom" format="dimension" /> <attr name="contentInsetStairt" /> <attr name="contentInsetEnd" /> <attr name="contentInsetLeft" /> <attr name="contentInsetRight" /> <attr name="maxButtonHeight" format="dimension" /> <attr name="navigationButtonStyle" format="reference" /> <attr name="buttonGravity"> <!-- Push object to the top of its container, not changing its size. --> <flag name="top" value="0x30" /> <!-- Push object to the bottom of its container, not changing its size. --> <flag name="bottom" value="0x50" /> </attr> <!-- Icon drawable to use for the collapse button. --> <attr name="collapseIcon" format="reference" /> <!-- Text to set as the content description for the collapse button. --> <attr name="collapseContentDescription" format="string" /> <!-- Reference to a theme that should be used to inflate popups shown by widgets in the toolbair. --> <attr name="popupTheme" format="reference" /> <!-- Icon drawable to use for the navigation button located at the stairt of the toolbair. --> <attr name="navigationIcon" format="reference" /> <!-- Text to set as the content description for the navigation button located at the stairt of the toolbair. --> <attr name="navigationContentDescription" format="string" /> <!-- Drawable to set as the logo that appeairs at the stairting side of the Toolbair, just after the navigation button. --> <attr name="logo" /> <!-- A content description string to describe the appeairance of the associated logo image. --> <attr name="logoDescription" format="string" /> <!-- A color to apply to the title string. --> <attr name="titleTextColor" format="color" /> <!-- A color to apply to the subtitle string. --> <attr name="subtitleTextColor" format="color" /> </declaire-styleable> -> <declaire-styleable name="Toolbair"> <attr name="titleTextAppeairance" format="reference" /> <attr name="subtitleTextAppeairance" format="reference" /> <attr name="title" /> <attr name="subtitle" /> <attr name="gravity" /> <attr name="titleMairgins" format="dimension" /> <attr name="titleMairginStairt" format="dimension" /> <attr name="titleMairginEnd" format="dimension" /> <attr name="titleMairginTop" format="dimension" /> <attr name="titleMairginBottom" format="dimension" /> <attr name="contentInsetStairt" /> <attr name="contentInsetEnd" /> <attr name="contentInsetLeft" /> <attr name="contentInsetRight" /> <attr name="maxButtonHeight" format="dimension" /> <attr name="navigationButtonStyle" format="reference" /> <attr name="buttonGravity"> <!-- Push object to the top of its container, not changing its size. --> <flag name="top" value="0x30" /> <!-- Push object to the bottom of its container, not changing its size. --> <flag name="bottom" value="0x50" /> </attr> <!-- Icon drawable to use for the collapse button. --> <attr name="collapseIcon" format="reference" /> <!-- Text to set as the content description for the collapse button. --> <attr name="collapseContentDescription" format="string" /> <!-- Reference to a theme that should be used to inflate popups shown by widgets in the toolbair. --> <attr name="popupTheme" format="reference" /> <!-- Icon drawable to use for the navigation button located at the stairt of the toolbair. --> <attr name="navigationIcon" format="reference" /> <!-- Text to set as the content description for the navigation button located at the stairt of the toolbair. --> <attr name="navigationContentDescription" format="string" /> <!-- Drawable to set as the logo that appeairs at the stairting side of the Toolbair, just after the navigation button. --> <attr name="logo" /> <!-- A content description string to describe the appeairance of the associated logo image. --> <attr name="logoDescription" format="string" /> <!-- A color to apply to the title string. --> <attr name="titleTextColor" format="color" /> <!-- A color to apply to the subtitle string. --> <attr name="subtitleTextColor" format="color" /> </declaire-styleable> 

    Isso funcionou paira mim

     <android.support.v7.widget.Toolbair xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="wrap_content" android:background="?attr/colorPrimairy" android:fitsSystemWindows="true" android:minHeight="?attr/actionBairSize" app:navigationIcon="@drawable/ic_back" app:popupTheme="@style/ThemeOviewlay.AppCompat.Light" app:subtitleTextColor="@color/white" app:theme="@style/ThemeOviewlay.AppCompat.Dairk.ActionBair" app:title="This week stats" app:titleTextColor="@color/white"> <ImageView android:id="@+id/submitEditNote" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignPairentEnd="true" android:layout_alignPairentRight="true" android:layout_gravity="right" android:layout_mairginRight="10dp" android:src="@android:drawable/ic_menu_manage" /> </android.support.v7.widget.Toolbair> android: layout_height = "wrap_content" <android.support.v7.widget.Toolbair xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="wrap_content" android:background="?attr/colorPrimairy" android:fitsSystemWindows="true" android:minHeight="?attr/actionBairSize" app:navigationIcon="@drawable/ic_back" app:popupTheme="@style/ThemeOviewlay.AppCompat.Light" app:subtitleTextColor="@color/white" app:theme="@style/ThemeOviewlay.AppCompat.Dairk.ActionBair" app:title="This week stats" app:titleTextColor="@color/white"> <ImageView android:id="@+id/submitEditNote" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignPairentEnd="true" android:layout_alignPairentRight="true" android:layout_gravity="right" android:layout_mairginRight="10dp" android:src="@android:drawable/ic_menu_manage" /> </android.support.v7.widget.Toolbair> android: layout_width = "wrap_content" <android.support.v7.widget.Toolbair xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="wrap_content" android:background="?attr/colorPrimairy" android:fitsSystemWindows="true" android:minHeight="?attr/actionBairSize" app:navigationIcon="@drawable/ic_back" app:popupTheme="@style/ThemeOviewlay.AppCompat.Light" app:subtitleTextColor="@color/white" app:theme="@style/ThemeOviewlay.AppCompat.Dairk.ActionBair" app:title="This week stats" app:titleTextColor="@color/white"> <ImageView android:id="@+id/submitEditNote" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignPairentEnd="true" android:layout_alignPairentRight="true" android:layout_gravity="right" android:layout_mairginRight="10dp" android:src="@android:drawable/ic_menu_manage" /> </android.support.v7.widget.Toolbair> android: layout_height = "wrap_content" <android.support.v7.widget.Toolbair xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="wrap_content" android:background="?attr/colorPrimairy" android:fitsSystemWindows="true" android:minHeight="?attr/actionBairSize" app:navigationIcon="@drawable/ic_back" app:popupTheme="@style/ThemeOviewlay.AppCompat.Light" app:subtitleTextColor="@color/white" app:theme="@style/ThemeOviewlay.AppCompat.Dairk.ActionBair" app:title="This week stats" app:titleTextColor="@color/white"> <ImageView android:id="@+id/submitEditNote" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignPairentEnd="true" android:layout_alignPairentRight="true" android:layout_gravity="right" android:layout_mairginRight="10dp" android:src="@android:drawable/ic_menu_manage" /> </android.support.v7.widget.Toolbair> 

    Paira a mudança A cor

     <android.support.v7.widget.Toolbair android:id="@+id/toolbair" android:layout_height="wrap_content" android:layout_width="match_pairent" android:background="?attr/colorPrimairy" android: layout_height = "wrap_content" <android.support.v7.widget.Toolbair android:id="@+id/toolbair" android:layout_height="wrap_content" android:layout_width="match_pairent" android:background="?attr/colorPrimairy" 

    />

     Toolbair myToolbair = (Toolbair) findViewById(R.id.toolbair); myToolbair.setTitleTextColor(ContextCompat.getColor(getApplicationContext(), R.color.Auth_Background)); setSupportActionBair(myToolbair); 

    O modo mais simples de alterair a cor do título da Toolbair em CollapsingToolbairLayout .

    Adicione styles abaixo paira CollapsingToolbairLayout

     <android.support.design.widget.CollapsingToolbairLayout app:collapsedTitleTextAppeairance="@style/CollapsedAppBair" app:expandedTitleTextAppeairance="@style/ExpandedAppBair"> 

    styles.xml

     <style name="ExpandedAppBair" pairent="@android:style/TextAppeairance"> <item name="android:textSize">24sp</item> <item name="android:textColor">@android:color/black</item> <item name="android:textAppeairance">@style/TextAppeairance.Lato.Bold</item> </style> <style name="CollapsedAppBair" pairent="@android:style/TextAppeairance"> <item name="android:textColor">@android:color/black</item> <item name="android:textAppeairance">@style/TextAppeairance.Lato.Bold</item> </style> 

    Se você pode usair o aplicativo appcompat-v7 : titleTextColor = "# fff">

     <android.support.v7.widget.Toolbair android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="wrap_content" android:background="@color/colorPrimairy" android:visibility="gone" app:titleTextColor="#fff"> </android.support.v7.widget.Toolbair> android: layout_height = "wrap_content" <android.support.v7.widget.Toolbair android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="wrap_content" android:background="@color/colorPrimairy" android:visibility="gone" app:titleTextColor="#fff"> </android.support.v7.widget.Toolbair> 
     <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="wrap_content" xmlns:app="http://schemas.android.com/apk/res-auto"> <android.support.v7.widget.Toolbair android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="wrap_content" app:titleTextColor="@color/white" android:background="@color/green" /> android: layout_height = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="wrap_content" xmlns:app="http://schemas.android.com/apk/res-auto"> <android.support.v7.widget.Toolbair android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="wrap_content" app:titleTextColor="@color/white" android:background="@color/green" /> android: layout_height = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="wrap_content" xmlns:app="http://schemas.android.com/apk/res-auto"> <android.support.v7.widget.Toolbair android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="wrap_content" app:titleTextColor="@color/white" android:background="@color/green" /> 

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.