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>
android
add a comment |
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>
android
add a comment |
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>
android
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
android
asked 23 hours ago
twistedmister
114
114
add a comment |
add a comment |
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>
add a comment |
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 :)
add a comment |
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.
add a comment |
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>
add a comment |
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>
add a comment |
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>
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>
answered 22 hours ago
Sai Jayant
139212
139212
add a comment |
add a comment |
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 :)
add a comment |
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 :)
add a comment |
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 :)
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 :)
answered 22 hours ago
Kevin Kurien
3849
3849
add a comment |
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
answered 22 hours ago
tm13
402116
402116
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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