I can't change the color of android windows title bar text color. I don't know what is the name to this. So I'm providing you a screenshot to understand. please see the blow image: ScreenShot
I searched for this question, but i didn't get any tutorials or answer from another forum. my post activity is showing the text color white. but home activity and another activity showing the text color Black.
I'm using toolbar layout. below provided toolbar xml code:
toolbar_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
app:elevation="0dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
android:minHeight="?attr/actionBarSize"
android:weightSum="1"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
app:elevation="0dp"
android:background="@color/red"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<net.gurujibd.jamunanews.view.PhenomenaTextView
android:id="@+id/toolbarTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="start"
android:gravity="center_vertical"
android:text="@string/app_name"
android:textColor="@color/title_color"
android:textSize="21sp"
android:textStyle="bold" />
<ImageButton
android:id="@+id/imgBtnSearch"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="20dp"
android:background="@drawable/ic_search" />
<RelativeLayout
android:id="@+id/notificationView"
android:layout_width="35dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/imgBtnSearch"
android:background="?selectableItemBackgroundBorderless"
android:clickable="true">
<ImageView
android:id="@+id/notiIcon"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_notification" />
<TextView
android:id="@+id/notificationCount"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_alignTop="@+id/notiIcon"
android:layout_marginBottom="13dp"
android:layout_alignParentRight="true"
android:background="@drawable/badge_circle"
android:gravity="center"
android:padding="0dp"
android:text="5"
android:textColor="#FFF"
android:textSize="9sp"
android:textStyle="bold" />
</RelativeLayout>
</RelativeLayout>
</android.support.v7.widget.Toolbar>
<View
android:layout_width="match_parent"
android:layout_height="0.7dp"
android:background="@color/toolbar_boarder" />
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
toolbar.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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
app:elevation="0dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:elevation="0dp"
android:minHeight="?attr/actionBarSize"
android:weightSum="1"
app:elevation="0dp"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
<View
android:layout_width="match_parent"
android:layout_height="0.7dp"
android:background="@color/toolbar_boarder" />
</android.support.design.widget.AppBarLayout>
hope i will get solution for this question.
thanks.
That is called status bar.
For api above 21:
In style.xml
<item name="android:statusBarColor">@color/status_bar_color</item>
<item name="android:windowLightStatusBar">false</item>
here
1.(added in api 21)android:statusBarColor
is background color of status bar and
2.(added in api 23)android:windowLightStatusBar
value false
makes status bar text color white and gray is true
.
For all api level, only changing status bar background color
It takes it's color from from style.xml
<item name="colorPrimaryDark">@color/primary_dark</item>
Change primary_dark from colors.xml to change status bar color
<color name="colorPrimaryDark">#bd3874ff</color>