Android ToolBar can change back button color but not title color












1















I want to change my Toolbar title color to blue. It stays white. I was able to set the back button but not the title color - am I missing something?



I've tried to change it at 3 different places:



Activity



    Toolbar toolbar = (Toolbar) findViewById(R.id.detail_toolbar);
toolbar.setTitleTextColor(0xff00ff99);
setSupportActionBar(toolbar);


activity.xml



        <android.support.v7.widget.Toolbar
android:id="@+id/detail_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:theme="@style/ToolBarStyle"
android:background="@color/colorPrimaryDark"
android:titleTextColor="@android:color/holo_red_dark"
app:subtitleTextColor="@color/colorPrimaryDark"
app:layout_collapseMode="pin"

app:popupTheme="@style/ToolBarStyle" />


v21 styles.xml



    <!-- ToolBar -->
<style name="ToolBarStyle" parent="Theme.AppCompat">

<item name="titleTextColor">@color/colorPrimaryDark</item>
<item name="android:titleTextColor">@color/colorPrimaryDark</item>
<item name="android:textColorPrimary">@color/colorPrimaryDark</item>
<item name="android:textColorSecondary">@color/colorPrimaryDark</item>
<item name="actionMenuTextColor">@color/colorPrimaryDark</item>
<item name="android:textColor">@color/colorPrimaryDark</item>
</style>


styles.xml



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


What am I missing?
It stays white no matter what. I've even went through the 150 references to #ffffff in the whole project and nowhere is the toolbar referenced there.



targetSdk 26, running on Android 7.1.1










share|improve this question





























    1















    I want to change my Toolbar title color to blue. It stays white. I was able to set the back button but not the title color - am I missing something?



    I've tried to change it at 3 different places:



    Activity



        Toolbar toolbar = (Toolbar) findViewById(R.id.detail_toolbar);
    toolbar.setTitleTextColor(0xff00ff99);
    setSupportActionBar(toolbar);


    activity.xml



            <android.support.v7.widget.Toolbar
    android:id="@+id/detail_toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    app:theme="@style/ToolBarStyle"
    android:background="@color/colorPrimaryDark"
    android:titleTextColor="@android:color/holo_red_dark"
    app:subtitleTextColor="@color/colorPrimaryDark"
    app:layout_collapseMode="pin"

    app:popupTheme="@style/ToolBarStyle" />


    v21 styles.xml



        <!-- ToolBar -->
    <style name="ToolBarStyle" parent="Theme.AppCompat">

    <item name="titleTextColor">@color/colorPrimaryDark</item>
    <item name="android:titleTextColor">@color/colorPrimaryDark</item>
    <item name="android:textColorPrimary">@color/colorPrimaryDark</item>
    <item name="android:textColorSecondary">@color/colorPrimaryDark</item>
    <item name="actionMenuTextColor">@color/colorPrimaryDark</item>
    <item name="android:textColor">@color/colorPrimaryDark</item>
    </style>


    styles.xml



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


    What am I missing?
    It stays white no matter what. I've even went through the 150 references to #ffffff in the whole project and nowhere is the toolbar referenced there.



    targetSdk 26, running on Android 7.1.1










    share|improve this question



























      1












      1








      1








      I want to change my Toolbar title color to blue. It stays white. I was able to set the back button but not the title color - am I missing something?



      I've tried to change it at 3 different places:



      Activity



          Toolbar toolbar = (Toolbar) findViewById(R.id.detail_toolbar);
      toolbar.setTitleTextColor(0xff00ff99);
      setSupportActionBar(toolbar);


      activity.xml



              <android.support.v7.widget.Toolbar
      android:id="@+id/detail_toolbar"
      android:layout_width="match_parent"
      android:layout_height="?attr/actionBarSize"
      app:theme="@style/ToolBarStyle"
      android:background="@color/colorPrimaryDark"
      android:titleTextColor="@android:color/holo_red_dark"
      app:subtitleTextColor="@color/colorPrimaryDark"
      app:layout_collapseMode="pin"

      app:popupTheme="@style/ToolBarStyle" />


      v21 styles.xml



          <!-- ToolBar -->
      <style name="ToolBarStyle" parent="Theme.AppCompat">

      <item name="titleTextColor">@color/colorPrimaryDark</item>
      <item name="android:titleTextColor">@color/colorPrimaryDark</item>
      <item name="android:textColorPrimary">@color/colorPrimaryDark</item>
      <item name="android:textColorSecondary">@color/colorPrimaryDark</item>
      <item name="actionMenuTextColor">@color/colorPrimaryDark</item>
      <item name="android:textColor">@color/colorPrimaryDark</item>
      </style>


      styles.xml



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


      What am I missing?
      It stays white no matter what. I've even went through the 150 references to #ffffff in the whole project and nowhere is the toolbar referenced there.



      targetSdk 26, running on Android 7.1.1










      share|improve this question
















      I want to change my Toolbar title color to blue. It stays white. I was able to set the back button but not the title color - am I missing something?



      I've tried to change it at 3 different places:



      Activity



          Toolbar toolbar = (Toolbar) findViewById(R.id.detail_toolbar);
      toolbar.setTitleTextColor(0xff00ff99);
      setSupportActionBar(toolbar);


      activity.xml



              <android.support.v7.widget.Toolbar
      android:id="@+id/detail_toolbar"
      android:layout_width="match_parent"
      android:layout_height="?attr/actionBarSize"
      app:theme="@style/ToolBarStyle"
      android:background="@color/colorPrimaryDark"
      android:titleTextColor="@android:color/holo_red_dark"
      app:subtitleTextColor="@color/colorPrimaryDark"
      app:layout_collapseMode="pin"

      app:popupTheme="@style/ToolBarStyle" />


      v21 styles.xml



          <!-- ToolBar -->
      <style name="ToolBarStyle" parent="Theme.AppCompat">

      <item name="titleTextColor">@color/colorPrimaryDark</item>
      <item name="android:titleTextColor">@color/colorPrimaryDark</item>
      <item name="android:textColorPrimary">@color/colorPrimaryDark</item>
      <item name="android:textColorSecondary">@color/colorPrimaryDark</item>
      <item name="actionMenuTextColor">@color/colorPrimaryDark</item>
      <item name="android:textColor">@color/colorPrimaryDark</item>
      </style>


      styles.xml



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


      What am I missing?
      It stays white no matter what. I've even went through the 150 references to #ffffff in the whole project and nowhere is the toolbar referenced there.



      targetSdk 26, running on Android 7.1.1







      android toolbar android-xml appcompat






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 7:48









      tm13

      5281320




      5281320










      asked Nov 23 '18 at 0:35









      user2875404user2875404

      1,40221428




      1,40221428
























          4 Answers
          4






          active

          oldest

          votes


















          1














          Create custom Toolbar like this:



          toolbar_layout.xml



          <?xml version="1.0" encoding="utf-8"?>
          <android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:app="http://schemas.android.com/apk/res-auto"
          xmlns:tools="http://schemas.android.com/tools"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:fitsSystemWindows="false"
          android:theme="@style/AppTheme.AppBarOverlay">

          <android.support.v7.widget.Toolbar
          android:id="@+id/toolbar"
          android:layout_width="match_parent"
          android:layout_height="?android:attr/actionBarSize"
          android:background="@android:color/backgroundColor"
          app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
          app:theme="@style/Base.Theme.AppCompat.Light.DarkActionBar">

          <TextView
          android:id="@+id/toolbar_title"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textColor="@color/blue"/>

          </android.support.v7.widget.Toolbar>
          </android.support.design.widget.AppBarLayout>


          Include it in you layout:



          <include layout="@layout/toolbar_layout"/>


          Use it in your activity's onCreate method:



          @Override
          protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_new_card);

          Toolbar toolbar = findViewById(R.id.toolbar);
          TextView toolbarTitle = findViewById(R.id.toolbar_title);

          setSupportActionBar(toolbar);
          if (getSupportActionBar() != null)
          getSupportActionBar().setDisplayShowTitleEnabled(false);

          toolbarTitle.setText("Your title");
          ...
          }


          Hope it will help.






          share|improve this answer































            1














            Try to change this:




            android:titleTextColor="@android:color/holo_red_dark"




            to:




            app:titleTextColor="@android:color/holo_red_dark"




            in your activity.xml android.support.v7.widget.Toolbar section.






            share|improve this answer


























            • Tried that, not working unfortunately :(

              – user2875404
              Nov 23 '18 at 0:50











            • It should, Also no need this in styles.xml. Try to remove this line: <item name="android:titleTextColor">@color/colorPrimaryDark</item> Some style definition interfere to other. Should remove unnecessary items in styles

              – Sinan Ceylan
              Nov 23 '18 at 0:52













            • Hey mate, I've found the issue now. Will write answer in a minute

              – user2875404
              Nov 23 '18 at 0:58











            • I've added my answer. Thanks a lot for your support tho, keep it up my friend!

              – user2875404
              Nov 23 '18 at 1:09



















            0














            Ok so I have found the answer by literally stack tracing my code.



            I have a PagerAdapter returning different fragments. I thought that each Activity was responsible to the Tabbar (it's a Master/Detail pattern for different tabs each) as I've had to set stuff like setSupportActionBar() which I've done in the subsequent Activities.



            Stacktracing my code I've realized that there is a CollapsingToolbarLayout being find by view ID. This is where I set the bar's title. From there, I didn't find any title property but I've let auto complete lead me to setCollapsedTitleTextColor and setExpandedTitleColor.



            So although the getColor() part is deprecated it's



            bar.setCollapsedTitleTextColor(getResources().getColor(R.color.colorPrimaryDark));
            bar.setExpandedTitleColor(getResources().getColor(R.color.colorPrimaryDark));


            Still no idea why all the other places I've set it at didn't do the trick but very happy it's working now.






            share|improve this answer































              0















              In Layout file use the Toolbar as Child layout of AppBarLayout




              <LinearLayout 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="match_parent"
              android:orientation="vertical">
              <android.support.design.widget.AppBarLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:theme="@style/AppTheme.AppBarOverlay">

              <android.support.v7.widget.Toolbar
              android:id="@+id/toolbar"
              android:layout_width="match_parent"
              android:layout_height="?attr/actionBarSize"
              android:background="?attr/colorPrimary"
              app:popupTheme="@style/AppTheme.PopupOverlay">

              </android.support.v7.widget.Toolbar>
              </android.support.design.widget.AppBarLayout>
              </LinearLayout>



              Style.xml




              <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
              <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />



              Inside MainActivity




               @Override
              protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_main);
              Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
              setSupportActionBar(toolbar);
              }





              share|improve this answer























                Your Answer






                StackExchange.ifUsing("editor", function () {
                StackExchange.using("externalEditor", function () {
                StackExchange.using("snippets", function () {
                StackExchange.snippets.init();
                });
                });
                }, "code-snippets");

                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "1"
                };
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function() {
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled) {
                StackExchange.using("snippets", function() {
                createEditor();
                });
                }
                else {
                createEditor();
                }
                });

                function createEditor() {
                StackExchange.prepareEditor({
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: true,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                imageUploader: {
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                },
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                });


                }
                });














                draft saved

                draft discarded


















                StackExchange.ready(
                function () {
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53439427%2fandroid-toolbar-can-change-back-button-color-but-not-title-color%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                4 Answers
                4






                active

                oldest

                votes








                4 Answers
                4






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                1














                Create custom Toolbar like this:



                toolbar_layout.xml



                <?xml version="1.0" encoding="utf-8"?>
                <android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:app="http://schemas.android.com/apk/res-auto"
                xmlns:tools="http://schemas.android.com/tools"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:fitsSystemWindows="false"
                android:theme="@style/AppTheme.AppBarOverlay">

                <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?android:attr/actionBarSize"
                android:background="@android:color/backgroundColor"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                app:theme="@style/Base.Theme.AppCompat.Light.DarkActionBar">

                <TextView
                android:id="@+id/toolbar_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@color/blue"/>

                </android.support.v7.widget.Toolbar>
                </android.support.design.widget.AppBarLayout>


                Include it in you layout:



                <include layout="@layout/toolbar_layout"/>


                Use it in your activity's onCreate method:



                @Override
                protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_new_card);

                Toolbar toolbar = findViewById(R.id.toolbar);
                TextView toolbarTitle = findViewById(R.id.toolbar_title);

                setSupportActionBar(toolbar);
                if (getSupportActionBar() != null)
                getSupportActionBar().setDisplayShowTitleEnabled(false);

                toolbarTitle.setText("Your title");
                ...
                }


                Hope it will help.






                share|improve this answer




























                  1














                  Create custom Toolbar like this:



                  toolbar_layout.xml



                  <?xml version="1.0" encoding="utf-8"?>
                  <android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  xmlns:app="http://schemas.android.com/apk/res-auto"
                  xmlns:tools="http://schemas.android.com/tools"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:fitsSystemWindows="false"
                  android:theme="@style/AppTheme.AppBarOverlay">

                  <android.support.v7.widget.Toolbar
                  android:id="@+id/toolbar"
                  android:layout_width="match_parent"
                  android:layout_height="?android:attr/actionBarSize"
                  android:background="@android:color/backgroundColor"
                  app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                  app:theme="@style/Base.Theme.AppCompat.Light.DarkActionBar">

                  <TextView
                  android:id="@+id/toolbar_title"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:textColor="@color/blue"/>

                  </android.support.v7.widget.Toolbar>
                  </android.support.design.widget.AppBarLayout>


                  Include it in you layout:



                  <include layout="@layout/toolbar_layout"/>


                  Use it in your activity's onCreate method:



                  @Override
                  protected void onCreate(Bundle savedInstanceState) {
                  super.onCreate(savedInstanceState);
                  setContentView(R.layout.activity_new_card);

                  Toolbar toolbar = findViewById(R.id.toolbar);
                  TextView toolbarTitle = findViewById(R.id.toolbar_title);

                  setSupportActionBar(toolbar);
                  if (getSupportActionBar() != null)
                  getSupportActionBar().setDisplayShowTitleEnabled(false);

                  toolbarTitle.setText("Your title");
                  ...
                  }


                  Hope it will help.






                  share|improve this answer


























                    1












                    1








                    1







                    Create custom Toolbar like this:



                    toolbar_layout.xml



                    <?xml version="1.0" encoding="utf-8"?>
                    <android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
                    xmlns:app="http://schemas.android.com/apk/res-auto"
                    xmlns:tools="http://schemas.android.com/tools"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:fitsSystemWindows="false"
                    android:theme="@style/AppTheme.AppBarOverlay">

                    <android.support.v7.widget.Toolbar
                    android:id="@+id/toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="?android:attr/actionBarSize"
                    android:background="@android:color/backgroundColor"
                    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                    app:theme="@style/Base.Theme.AppCompat.Light.DarkActionBar">

                    <TextView
                    android:id="@+id/toolbar_title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="@color/blue"/>

                    </android.support.v7.widget.Toolbar>
                    </android.support.design.widget.AppBarLayout>


                    Include it in you layout:



                    <include layout="@layout/toolbar_layout"/>


                    Use it in your activity's onCreate method:



                    @Override
                    protected void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    setContentView(R.layout.activity_new_card);

                    Toolbar toolbar = findViewById(R.id.toolbar);
                    TextView toolbarTitle = findViewById(R.id.toolbar_title);

                    setSupportActionBar(toolbar);
                    if (getSupportActionBar() != null)
                    getSupportActionBar().setDisplayShowTitleEnabled(false);

                    toolbarTitle.setText("Your title");
                    ...
                    }


                    Hope it will help.






                    share|improve this answer













                    Create custom Toolbar like this:



                    toolbar_layout.xml



                    <?xml version="1.0" encoding="utf-8"?>
                    <android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
                    xmlns:app="http://schemas.android.com/apk/res-auto"
                    xmlns:tools="http://schemas.android.com/tools"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:fitsSystemWindows="false"
                    android:theme="@style/AppTheme.AppBarOverlay">

                    <android.support.v7.widget.Toolbar
                    android:id="@+id/toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="?android:attr/actionBarSize"
                    android:background="@android:color/backgroundColor"
                    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                    app:theme="@style/Base.Theme.AppCompat.Light.DarkActionBar">

                    <TextView
                    android:id="@+id/toolbar_title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="@color/blue"/>

                    </android.support.v7.widget.Toolbar>
                    </android.support.design.widget.AppBarLayout>


                    Include it in you layout:



                    <include layout="@layout/toolbar_layout"/>


                    Use it in your activity's onCreate method:



                    @Override
                    protected void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    setContentView(R.layout.activity_new_card);

                    Toolbar toolbar = findViewById(R.id.toolbar);
                    TextView toolbarTitle = findViewById(R.id.toolbar_title);

                    setSupportActionBar(toolbar);
                    if (getSupportActionBar() != null)
                    getSupportActionBar().setDisplayShowTitleEnabled(false);

                    toolbarTitle.setText("Your title");
                    ...
                    }


                    Hope it will help.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 23 '18 at 5:19









                    tm13tm13

                    5281320




                    5281320

























                        1














                        Try to change this:




                        android:titleTextColor="@android:color/holo_red_dark"




                        to:




                        app:titleTextColor="@android:color/holo_red_dark"




                        in your activity.xml android.support.v7.widget.Toolbar section.






                        share|improve this answer


























                        • Tried that, not working unfortunately :(

                          – user2875404
                          Nov 23 '18 at 0:50











                        • It should, Also no need this in styles.xml. Try to remove this line: <item name="android:titleTextColor">@color/colorPrimaryDark</item> Some style definition interfere to other. Should remove unnecessary items in styles

                          – Sinan Ceylan
                          Nov 23 '18 at 0:52













                        • Hey mate, I've found the issue now. Will write answer in a minute

                          – user2875404
                          Nov 23 '18 at 0:58











                        • I've added my answer. Thanks a lot for your support tho, keep it up my friend!

                          – user2875404
                          Nov 23 '18 at 1:09
















                        1














                        Try to change this:




                        android:titleTextColor="@android:color/holo_red_dark"




                        to:




                        app:titleTextColor="@android:color/holo_red_dark"




                        in your activity.xml android.support.v7.widget.Toolbar section.






                        share|improve this answer


























                        • Tried that, not working unfortunately :(

                          – user2875404
                          Nov 23 '18 at 0:50











                        • It should, Also no need this in styles.xml. Try to remove this line: <item name="android:titleTextColor">@color/colorPrimaryDark</item> Some style definition interfere to other. Should remove unnecessary items in styles

                          – Sinan Ceylan
                          Nov 23 '18 at 0:52













                        • Hey mate, I've found the issue now. Will write answer in a minute

                          – user2875404
                          Nov 23 '18 at 0:58











                        • I've added my answer. Thanks a lot for your support tho, keep it up my friend!

                          – user2875404
                          Nov 23 '18 at 1:09














                        1












                        1








                        1







                        Try to change this:




                        android:titleTextColor="@android:color/holo_red_dark"




                        to:




                        app:titleTextColor="@android:color/holo_red_dark"




                        in your activity.xml android.support.v7.widget.Toolbar section.






                        share|improve this answer















                        Try to change this:




                        android:titleTextColor="@android:color/holo_red_dark"




                        to:




                        app:titleTextColor="@android:color/holo_red_dark"




                        in your activity.xml android.support.v7.widget.Toolbar section.







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Nov 23 '18 at 5:23









                        Rahul Sharma

                        2,2691619




                        2,2691619










                        answered Nov 23 '18 at 0:48









                        Sinan CeylanSinan Ceylan

                        41427




                        41427













                        • Tried that, not working unfortunately :(

                          – user2875404
                          Nov 23 '18 at 0:50











                        • It should, Also no need this in styles.xml. Try to remove this line: <item name="android:titleTextColor">@color/colorPrimaryDark</item> Some style definition interfere to other. Should remove unnecessary items in styles

                          – Sinan Ceylan
                          Nov 23 '18 at 0:52













                        • Hey mate, I've found the issue now. Will write answer in a minute

                          – user2875404
                          Nov 23 '18 at 0:58











                        • I've added my answer. Thanks a lot for your support tho, keep it up my friend!

                          – user2875404
                          Nov 23 '18 at 1:09



















                        • Tried that, not working unfortunately :(

                          – user2875404
                          Nov 23 '18 at 0:50











                        • It should, Also no need this in styles.xml. Try to remove this line: <item name="android:titleTextColor">@color/colorPrimaryDark</item> Some style definition interfere to other. Should remove unnecessary items in styles

                          – Sinan Ceylan
                          Nov 23 '18 at 0:52













                        • Hey mate, I've found the issue now. Will write answer in a minute

                          – user2875404
                          Nov 23 '18 at 0:58











                        • I've added my answer. Thanks a lot for your support tho, keep it up my friend!

                          – user2875404
                          Nov 23 '18 at 1:09

















                        Tried that, not working unfortunately :(

                        – user2875404
                        Nov 23 '18 at 0:50





                        Tried that, not working unfortunately :(

                        – user2875404
                        Nov 23 '18 at 0:50













                        It should, Also no need this in styles.xml. Try to remove this line: <item name="android:titleTextColor">@color/colorPrimaryDark</item> Some style definition interfere to other. Should remove unnecessary items in styles

                        – Sinan Ceylan
                        Nov 23 '18 at 0:52







                        It should, Also no need this in styles.xml. Try to remove this line: <item name="android:titleTextColor">@color/colorPrimaryDark</item> Some style definition interfere to other. Should remove unnecessary items in styles

                        – Sinan Ceylan
                        Nov 23 '18 at 0:52















                        Hey mate, I've found the issue now. Will write answer in a minute

                        – user2875404
                        Nov 23 '18 at 0:58





                        Hey mate, I've found the issue now. Will write answer in a minute

                        – user2875404
                        Nov 23 '18 at 0:58













                        I've added my answer. Thanks a lot for your support tho, keep it up my friend!

                        – user2875404
                        Nov 23 '18 at 1:09





                        I've added my answer. Thanks a lot for your support tho, keep it up my friend!

                        – user2875404
                        Nov 23 '18 at 1:09











                        0














                        Ok so I have found the answer by literally stack tracing my code.



                        I have a PagerAdapter returning different fragments. I thought that each Activity was responsible to the Tabbar (it's a Master/Detail pattern for different tabs each) as I've had to set stuff like setSupportActionBar() which I've done in the subsequent Activities.



                        Stacktracing my code I've realized that there is a CollapsingToolbarLayout being find by view ID. This is where I set the bar's title. From there, I didn't find any title property but I've let auto complete lead me to setCollapsedTitleTextColor and setExpandedTitleColor.



                        So although the getColor() part is deprecated it's



                        bar.setCollapsedTitleTextColor(getResources().getColor(R.color.colorPrimaryDark));
                        bar.setExpandedTitleColor(getResources().getColor(R.color.colorPrimaryDark));


                        Still no idea why all the other places I've set it at didn't do the trick but very happy it's working now.






                        share|improve this answer




























                          0














                          Ok so I have found the answer by literally stack tracing my code.



                          I have a PagerAdapter returning different fragments. I thought that each Activity was responsible to the Tabbar (it's a Master/Detail pattern for different tabs each) as I've had to set stuff like setSupportActionBar() which I've done in the subsequent Activities.



                          Stacktracing my code I've realized that there is a CollapsingToolbarLayout being find by view ID. This is where I set the bar's title. From there, I didn't find any title property but I've let auto complete lead me to setCollapsedTitleTextColor and setExpandedTitleColor.



                          So although the getColor() part is deprecated it's



                          bar.setCollapsedTitleTextColor(getResources().getColor(R.color.colorPrimaryDark));
                          bar.setExpandedTitleColor(getResources().getColor(R.color.colorPrimaryDark));


                          Still no idea why all the other places I've set it at didn't do the trick but very happy it's working now.






                          share|improve this answer


























                            0












                            0








                            0







                            Ok so I have found the answer by literally stack tracing my code.



                            I have a PagerAdapter returning different fragments. I thought that each Activity was responsible to the Tabbar (it's a Master/Detail pattern for different tabs each) as I've had to set stuff like setSupportActionBar() which I've done in the subsequent Activities.



                            Stacktracing my code I've realized that there is a CollapsingToolbarLayout being find by view ID. This is where I set the bar's title. From there, I didn't find any title property but I've let auto complete lead me to setCollapsedTitleTextColor and setExpandedTitleColor.



                            So although the getColor() part is deprecated it's



                            bar.setCollapsedTitleTextColor(getResources().getColor(R.color.colorPrimaryDark));
                            bar.setExpandedTitleColor(getResources().getColor(R.color.colorPrimaryDark));


                            Still no idea why all the other places I've set it at didn't do the trick but very happy it's working now.






                            share|improve this answer













                            Ok so I have found the answer by literally stack tracing my code.



                            I have a PagerAdapter returning different fragments. I thought that each Activity was responsible to the Tabbar (it's a Master/Detail pattern for different tabs each) as I've had to set stuff like setSupportActionBar() which I've done in the subsequent Activities.



                            Stacktracing my code I've realized that there is a CollapsingToolbarLayout being find by view ID. This is where I set the bar's title. From there, I didn't find any title property but I've let auto complete lead me to setCollapsedTitleTextColor and setExpandedTitleColor.



                            So although the getColor() part is deprecated it's



                            bar.setCollapsedTitleTextColor(getResources().getColor(R.color.colorPrimaryDark));
                            bar.setExpandedTitleColor(getResources().getColor(R.color.colorPrimaryDark));


                            Still no idea why all the other places I've set it at didn't do the trick but very happy it's working now.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 23 '18 at 1:08









                            user2875404user2875404

                            1,40221428




                            1,40221428























                                0















                                In Layout file use the Toolbar as Child layout of AppBarLayout




                                <LinearLayout 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="match_parent"
                                android:orientation="vertical">
                                <android.support.design.widget.AppBarLayout
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:theme="@style/AppTheme.AppBarOverlay">

                                <android.support.v7.widget.Toolbar
                                android:id="@+id/toolbar"
                                android:layout_width="match_parent"
                                android:layout_height="?attr/actionBarSize"
                                android:background="?attr/colorPrimary"
                                app:popupTheme="@style/AppTheme.PopupOverlay">

                                </android.support.v7.widget.Toolbar>
                                </android.support.design.widget.AppBarLayout>
                                </LinearLayout>



                                Style.xml




                                <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
                                <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />



                                Inside MainActivity




                                 @Override
                                protected void onCreate(Bundle savedInstanceState) {
                                super.onCreate(savedInstanceState);
                                setContentView(R.layout.activity_main);
                                Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
                                setSupportActionBar(toolbar);
                                }





                                share|improve this answer




























                                  0















                                  In Layout file use the Toolbar as Child layout of AppBarLayout




                                  <LinearLayout 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="match_parent"
                                  android:orientation="vertical">
                                  <android.support.design.widget.AppBarLayout
                                  android:layout_width="match_parent"
                                  android:layout_height="wrap_content"
                                  android:theme="@style/AppTheme.AppBarOverlay">

                                  <android.support.v7.widget.Toolbar
                                  android:id="@+id/toolbar"
                                  android:layout_width="match_parent"
                                  android:layout_height="?attr/actionBarSize"
                                  android:background="?attr/colorPrimary"
                                  app:popupTheme="@style/AppTheme.PopupOverlay">

                                  </android.support.v7.widget.Toolbar>
                                  </android.support.design.widget.AppBarLayout>
                                  </LinearLayout>



                                  Style.xml




                                  <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
                                  <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />



                                  Inside MainActivity




                                   @Override
                                  protected void onCreate(Bundle savedInstanceState) {
                                  super.onCreate(savedInstanceState);
                                  setContentView(R.layout.activity_main);
                                  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
                                  setSupportActionBar(toolbar);
                                  }





                                  share|improve this answer


























                                    0












                                    0








                                    0








                                    In Layout file use the Toolbar as Child layout of AppBarLayout




                                    <LinearLayout 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="match_parent"
                                    android:orientation="vertical">
                                    <android.support.design.widget.AppBarLayout
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:theme="@style/AppTheme.AppBarOverlay">

                                    <android.support.v7.widget.Toolbar
                                    android:id="@+id/toolbar"
                                    android:layout_width="match_parent"
                                    android:layout_height="?attr/actionBarSize"
                                    android:background="?attr/colorPrimary"
                                    app:popupTheme="@style/AppTheme.PopupOverlay">

                                    </android.support.v7.widget.Toolbar>
                                    </android.support.design.widget.AppBarLayout>
                                    </LinearLayout>



                                    Style.xml




                                    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
                                    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />



                                    Inside MainActivity




                                     @Override
                                    protected void onCreate(Bundle savedInstanceState) {
                                    super.onCreate(savedInstanceState);
                                    setContentView(R.layout.activity_main);
                                    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
                                    setSupportActionBar(toolbar);
                                    }





                                    share|improve this answer














                                    In Layout file use the Toolbar as Child layout of AppBarLayout




                                    <LinearLayout 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="match_parent"
                                    android:orientation="vertical">
                                    <android.support.design.widget.AppBarLayout
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:theme="@style/AppTheme.AppBarOverlay">

                                    <android.support.v7.widget.Toolbar
                                    android:id="@+id/toolbar"
                                    android:layout_width="match_parent"
                                    android:layout_height="?attr/actionBarSize"
                                    android:background="?attr/colorPrimary"
                                    app:popupTheme="@style/AppTheme.PopupOverlay">

                                    </android.support.v7.widget.Toolbar>
                                    </android.support.design.widget.AppBarLayout>
                                    </LinearLayout>



                                    Style.xml




                                    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
                                    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />



                                    Inside MainActivity




                                     @Override
                                    protected void onCreate(Bundle savedInstanceState) {
                                    super.onCreate(savedInstanceState);
                                    setContentView(R.layout.activity_main);
                                    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
                                    setSupportActionBar(toolbar);
                                    }






                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Nov 23 '18 at 6:04









                                    jessicajessica

                                    1,1011616




                                    1,1011616






























                                        draft saved

                                        draft discarded




















































                                        Thanks for contributing an answer to Stack Overflow!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53439427%2fandroid-toolbar-can-change-back-button-color-but-not-title-color%23new-answer', 'question_page');
                                        }
                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        404 Error Contact Form 7 ajax form submitting

                                        How to know if a Active Directory user can login interactively

                                        TypeError: fit_transform() missing 1 required positional argument: 'X'