Why won't the text color in the app bar change?











up vote
0
down vote

favorite












the color of the text and icons in the app bar continue to be white, even though I'm trying to set them to be brown. What's wrong with my styles?



<style name="HobbesActionBarStyle" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:background">@color/HobbesBackground</item>
<item name="android:tint">@color/HobbesText</item>
<item name="colorControlNormal">@color/HobbesText</item>
<item name="android:subtitleTextStyle">@style/Hobbes.ActionBar.CustomTitle</item>
<item name="android:titleTextStyle">@style/Hobbes.ActionBar.CustomTitle</item>
<item name="subtitleTextStyle">@style/Hobbes.ActionBar.CustomTitle</item>
<item name="titleTextStyle">@style/Hobbes.ActionBar.CustomTitle</item>
</style>


<!-- ActionBar title text -->
<style name="Hobbes.ActionBar.CustomTitle" parent="Widget.AppCompat.ActionBar">
<item name="android:textColor">@color/HobbesText</item>
<!-- The textColor property is backward compatible with the Support Library -->
</style>

<style name="HobbesAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/HobbesActionBarStyle</item>
<item name="actionModeBackground">@color/HobbesBackground</item>
<item name="colorPrimary">@color/HobbesBackground</item>
<item name="colorPrimaryDark">@color/black_overlay</item>
<item name="colorControlNormal">@color/HobbesBackground</item>
<item name="colorControlActivated">@color/HobbesBackground</item>
<item name="colorControlHighlight">@color/HobbesBackground</item>
<item name="colorAccent">@color/HobbesText</item>

</style>









share|improve this question


























    up vote
    0
    down vote

    favorite












    the color of the text and icons in the app bar continue to be white, even though I'm trying to set them to be brown. What's wrong with my styles?



    <style name="HobbesActionBarStyle" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:background">@color/HobbesBackground</item>
    <item name="android:tint">@color/HobbesText</item>
    <item name="colorControlNormal">@color/HobbesText</item>
    <item name="android:subtitleTextStyle">@style/Hobbes.ActionBar.CustomTitle</item>
    <item name="android:titleTextStyle">@style/Hobbes.ActionBar.CustomTitle</item>
    <item name="subtitleTextStyle">@style/Hobbes.ActionBar.CustomTitle</item>
    <item name="titleTextStyle">@style/Hobbes.ActionBar.CustomTitle</item>
    </style>


    <!-- ActionBar title text -->
    <style name="Hobbes.ActionBar.CustomTitle" parent="Widget.AppCompat.ActionBar">
    <item name="android:textColor">@color/HobbesText</item>
    <!-- The textColor property is backward compatible with the Support Library -->
    </style>

    <style name="HobbesAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:actionBarStyle">@style/HobbesActionBarStyle</item>
    <item name="actionModeBackground">@color/HobbesBackground</item>
    <item name="colorPrimary">@color/HobbesBackground</item>
    <item name="colorPrimaryDark">@color/black_overlay</item>
    <item name="colorControlNormal">@color/HobbesBackground</item>
    <item name="colorControlActivated">@color/HobbesBackground</item>
    <item name="colorControlHighlight">@color/HobbesBackground</item>
    <item name="colorAccent">@color/HobbesText</item>

    </style>









    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      the color of the text and icons in the app bar continue to be white, even though I'm trying to set them to be brown. What's wrong with my styles?



      <style name="HobbesActionBarStyle" parent="Theme.AppCompat.Light.DarkActionBar">
      <item name="android:background">@color/HobbesBackground</item>
      <item name="android:tint">@color/HobbesText</item>
      <item name="colorControlNormal">@color/HobbesText</item>
      <item name="android:subtitleTextStyle">@style/Hobbes.ActionBar.CustomTitle</item>
      <item name="android:titleTextStyle">@style/Hobbes.ActionBar.CustomTitle</item>
      <item name="subtitleTextStyle">@style/Hobbes.ActionBar.CustomTitle</item>
      <item name="titleTextStyle">@style/Hobbes.ActionBar.CustomTitle</item>
      </style>


      <!-- ActionBar title text -->
      <style name="Hobbes.ActionBar.CustomTitle" parent="Widget.AppCompat.ActionBar">
      <item name="android:textColor">@color/HobbesText</item>
      <!-- The textColor property is backward compatible with the Support Library -->
      </style>

      <style name="HobbesAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
      <item name="android:actionBarStyle">@style/HobbesActionBarStyle</item>
      <item name="actionModeBackground">@color/HobbesBackground</item>
      <item name="colorPrimary">@color/HobbesBackground</item>
      <item name="colorPrimaryDark">@color/black_overlay</item>
      <item name="colorControlNormal">@color/HobbesBackground</item>
      <item name="colorControlActivated">@color/HobbesBackground</item>
      <item name="colorControlHighlight">@color/HobbesBackground</item>
      <item name="colorAccent">@color/HobbesText</item>

      </style>









      share|improve this question













      the color of the text and icons in the app bar continue to be white, even though I'm trying to set them to be brown. What's wrong with my styles?



      <style name="HobbesActionBarStyle" parent="Theme.AppCompat.Light.DarkActionBar">
      <item name="android:background">@color/HobbesBackground</item>
      <item name="android:tint">@color/HobbesText</item>
      <item name="colorControlNormal">@color/HobbesText</item>
      <item name="android:subtitleTextStyle">@style/Hobbes.ActionBar.CustomTitle</item>
      <item name="android:titleTextStyle">@style/Hobbes.ActionBar.CustomTitle</item>
      <item name="subtitleTextStyle">@style/Hobbes.ActionBar.CustomTitle</item>
      <item name="titleTextStyle">@style/Hobbes.ActionBar.CustomTitle</item>
      </style>


      <!-- ActionBar title text -->
      <style name="Hobbes.ActionBar.CustomTitle" parent="Widget.AppCompat.ActionBar">
      <item name="android:textColor">@color/HobbesText</item>
      <!-- The textColor property is backward compatible with the Support Library -->
      </style>

      <style name="HobbesAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
      <item name="android:actionBarStyle">@style/HobbesActionBarStyle</item>
      <item name="actionModeBackground">@color/HobbesBackground</item>
      <item name="colorPrimary">@color/HobbesBackground</item>
      <item name="colorPrimaryDark">@color/black_overlay</item>
      <item name="colorControlNormal">@color/HobbesBackground</item>
      <item name="colorControlActivated">@color/HobbesBackground</item>
      <item name="colorControlHighlight">@color/HobbesBackground</item>
      <item name="colorAccent">@color/HobbesText</item>

      </style>






      android






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 23 hours ago









      twistedmister

      114




      114
























          3 Answers
          3






          active

          oldest

          votes

















          up vote
          0
          down vote













          You have to add textColorPrimary in style






              <item name="android:textColorPrimary">@color/colorRed</item>








          <style name="appBarTheme" parent="Theme.AppCompat.NoActionBar">
          <item name="android:textColorPrimary">@color/colorRed</item>
          </style>








          share|improve this answer




























            up vote
            0
            down vote













            This is how I did it :



            in xml :



                 <?xml version="1.0" encoding="utf-8"?>
            <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@android:drawable/dark_header">


            <android.support.design.widget.AppBarLayout
            android:id="@+id/appbar"
            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"
            android:baselineAligned="false"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

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

            </RelativeLayout>


            In styles.xml :



             <style name="AppTheme.NoActionBar">
            <item name="windowActionBar">false</item>
            <item name="windowNoTitle">true</item>
            </style>

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

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


            In activity.xml



             <include
            android:id="@+id/header"
            layout="@layout/common_header"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />


            In Activity :



            private void setToolBar() {
            toolbar = (Toolbar) findViewById(R.id.toolbar);
            setSupportActionBar(toolbar);
            ActionBar actionBar = getSupportActionBar();
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
            final Drawable upArrow = getApplicationContext().getResources().getDrawable(R.drawable.abc_ic_ab_back_material); // this adds the back button remove it if you dont want it
            actionBar.setHomeAsUpIndicator(upArrow);
            actionBar.setDisplayShowTitleEnabled(true);
            toolbar.setTitleTextColor(getColor(R.color.colorAccent)); // this changes the text color
            actionBar.setTitle("title name);
            context = getApplicationContext();
            }


            hope it helps :)






            share|improve this answer




























              up vote
              0
              down vote













              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/yourCustomColor"/>

              </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





















                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',
                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%2f53371111%2fwhy-wont-the-text-color-in-the-app-bar-change%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                3 Answers
                3






                active

                oldest

                votes








                3 Answers
                3






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                0
                down vote













                You have to add textColorPrimary in style






                    <item name="android:textColorPrimary">@color/colorRed</item>








                <style name="appBarTheme" parent="Theme.AppCompat.NoActionBar">
                <item name="android:textColorPrimary">@color/colorRed</item>
                </style>








                share|improve this answer

























                  up vote
                  0
                  down vote













                  You have to add textColorPrimary in style






                      <item name="android:textColorPrimary">@color/colorRed</item>








                  <style name="appBarTheme" parent="Theme.AppCompat.NoActionBar">
                  <item name="android:textColorPrimary">@color/colorRed</item>
                  </style>








                  share|improve this answer























                    up vote
                    0
                    down vote










                    up vote
                    0
                    down vote









                    You have to add textColorPrimary in style






                        <item name="android:textColorPrimary">@color/colorRed</item>








                    <style name="appBarTheme" parent="Theme.AppCompat.NoActionBar">
                    <item name="android:textColorPrimary">@color/colorRed</item>
                    </style>








                    share|improve this answer












                    You have to add textColorPrimary in style






                        <item name="android:textColorPrimary">@color/colorRed</item>








                    <style name="appBarTheme" parent="Theme.AppCompat.NoActionBar">
                    <item name="android:textColorPrimary">@color/colorRed</item>
                    </style>








                        <item name="android:textColorPrimary">@color/colorRed</item>





                        <item name="android:textColorPrimary">@color/colorRed</item>





                    <style name="appBarTheme" parent="Theme.AppCompat.NoActionBar">
                    <item name="android:textColorPrimary">@color/colorRed</item>
                    </style>





                    <style name="appBarTheme" parent="Theme.AppCompat.NoActionBar">
                    <item name="android:textColorPrimary">@color/colorRed</item>
                    </style>






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 22 hours ago









                    Sai Jayant

                    139212




                    139212
























                        up vote
                        0
                        down vote













                        This is how I did it :



                        in xml :



                             <?xml version="1.0" encoding="utf-8"?>
                        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                        xmlns:app="http://schemas.android.com/apk/res-auto"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:background="@android:drawable/dark_header">


                        <android.support.design.widget.AppBarLayout
                        android:id="@+id/appbar"
                        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"
                        android:baselineAligned="false"
                        app:popupTheme="@style/AppTheme.PopupOverlay" />

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

                        </RelativeLayout>


                        In styles.xml :



                         <style name="AppTheme.NoActionBar">
                        <item name="windowActionBar">false</item>
                        <item name="windowNoTitle">true</item>
                        </style>

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

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


                        In activity.xml



                         <include
                        android:id="@+id/header"
                        layout="@layout/common_header"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content" />


                        In Activity :



                        private void setToolBar() {
                        toolbar = (Toolbar) findViewById(R.id.toolbar);
                        setSupportActionBar(toolbar);
                        ActionBar actionBar = getSupportActionBar();
                        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
                        final Drawable upArrow = getApplicationContext().getResources().getDrawable(R.drawable.abc_ic_ab_back_material); // this adds the back button remove it if you dont want it
                        actionBar.setHomeAsUpIndicator(upArrow);
                        actionBar.setDisplayShowTitleEnabled(true);
                        toolbar.setTitleTextColor(getColor(R.color.colorAccent)); // this changes the text color
                        actionBar.setTitle("title name);
                        context = getApplicationContext();
                        }


                        hope it helps :)






                        share|improve this answer

























                          up vote
                          0
                          down vote













                          This is how I did it :



                          in xml :



                               <?xml version="1.0" encoding="utf-8"?>
                          <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                          xmlns:app="http://schemas.android.com/apk/res-auto"
                          android:layout_width="fill_parent"
                          android:layout_height="wrap_content"
                          android:background="@android:drawable/dark_header">


                          <android.support.design.widget.AppBarLayout
                          android:id="@+id/appbar"
                          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"
                          android:baselineAligned="false"
                          app:popupTheme="@style/AppTheme.PopupOverlay" />

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

                          </RelativeLayout>


                          In styles.xml :



                           <style name="AppTheme.NoActionBar">
                          <item name="windowActionBar">false</item>
                          <item name="windowNoTitle">true</item>
                          </style>

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

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


                          In activity.xml



                           <include
                          android:id="@+id/header"
                          layout="@layout/common_header"
                          android:layout_width="fill_parent"
                          android:layout_height="wrap_content" />


                          In Activity :



                          private void setToolBar() {
                          toolbar = (Toolbar) findViewById(R.id.toolbar);
                          setSupportActionBar(toolbar);
                          ActionBar actionBar = getSupportActionBar();
                          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
                          final Drawable upArrow = getApplicationContext().getResources().getDrawable(R.drawable.abc_ic_ab_back_material); // this adds the back button remove it if you dont want it
                          actionBar.setHomeAsUpIndicator(upArrow);
                          actionBar.setDisplayShowTitleEnabled(true);
                          toolbar.setTitleTextColor(getColor(R.color.colorAccent)); // this changes the text color
                          actionBar.setTitle("title name);
                          context = getApplicationContext();
                          }


                          hope it helps :)






                          share|improve this answer























                            up vote
                            0
                            down vote










                            up vote
                            0
                            down vote









                            This is how I did it :



                            in xml :



                                 <?xml version="1.0" encoding="utf-8"?>
                            <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                            xmlns:app="http://schemas.android.com/apk/res-auto"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content"
                            android:background="@android:drawable/dark_header">


                            <android.support.design.widget.AppBarLayout
                            android:id="@+id/appbar"
                            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"
                            android:baselineAligned="false"
                            app:popupTheme="@style/AppTheme.PopupOverlay" />

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

                            </RelativeLayout>


                            In styles.xml :



                             <style name="AppTheme.NoActionBar">
                            <item name="windowActionBar">false</item>
                            <item name="windowNoTitle">true</item>
                            </style>

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

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


                            In activity.xml



                             <include
                            android:id="@+id/header"
                            layout="@layout/common_header"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content" />


                            In Activity :



                            private void setToolBar() {
                            toolbar = (Toolbar) findViewById(R.id.toolbar);
                            setSupportActionBar(toolbar);
                            ActionBar actionBar = getSupportActionBar();
                            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
                            final Drawable upArrow = getApplicationContext().getResources().getDrawable(R.drawable.abc_ic_ab_back_material); // this adds the back button remove it if you dont want it
                            actionBar.setHomeAsUpIndicator(upArrow);
                            actionBar.setDisplayShowTitleEnabled(true);
                            toolbar.setTitleTextColor(getColor(R.color.colorAccent)); // this changes the text color
                            actionBar.setTitle("title name);
                            context = getApplicationContext();
                            }


                            hope it helps :)






                            share|improve this answer












                            This is how I did it :



                            in xml :



                                 <?xml version="1.0" encoding="utf-8"?>
                            <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                            xmlns:app="http://schemas.android.com/apk/res-auto"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content"
                            android:background="@android:drawable/dark_header">


                            <android.support.design.widget.AppBarLayout
                            android:id="@+id/appbar"
                            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"
                            android:baselineAligned="false"
                            app:popupTheme="@style/AppTheme.PopupOverlay" />

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

                            </RelativeLayout>


                            In styles.xml :



                             <style name="AppTheme.NoActionBar">
                            <item name="windowActionBar">false</item>
                            <item name="windowNoTitle">true</item>
                            </style>

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

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


                            In activity.xml



                             <include
                            android:id="@+id/header"
                            layout="@layout/common_header"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content" />


                            In Activity :



                            private void setToolBar() {
                            toolbar = (Toolbar) findViewById(R.id.toolbar);
                            setSupportActionBar(toolbar);
                            ActionBar actionBar = getSupportActionBar();
                            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
                            final Drawable upArrow = getApplicationContext().getResources().getDrawable(R.drawable.abc_ic_ab_back_material); // this adds the back button remove it if you dont want it
                            actionBar.setHomeAsUpIndicator(upArrow);
                            actionBar.setDisplayShowTitleEnabled(true);
                            toolbar.setTitleTextColor(getColor(R.color.colorAccent)); // this changes the text color
                            actionBar.setTitle("title name);
                            context = getApplicationContext();
                            }


                            hope it helps :)







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 22 hours ago









                            Kevin Kurien

                            3849




                            3849






















                                up vote
                                0
                                down vote













                                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/yourCustomColor"/>

                                </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

























                                  up vote
                                  0
                                  down vote













                                  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/yourCustomColor"/>

                                  </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























                                    up vote
                                    0
                                    down vote










                                    up vote
                                    0
                                    down vote









                                    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/yourCustomColor"/>

                                    </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/yourCustomColor"/>

                                    </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 22 hours ago









                                    tm13

                                    402116




                                    402116






























                                         

                                        draft saved


                                        draft discarded



















































                                         


                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371111%2fwhy-wont-the-text-color-in-the-app-bar-change%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

                                        Volksrepublik China

                                        How to test boost logger output in unit testing?

                                        Write to the output between two pipeline