1

How can i change bgcolor of title bar. By default white color is assigned to it, due to which battery usage,time & notification icons are not visible.

Check this image link for problem description :

screenshot

I have set an image to relative layout :

android:background="@drawable/img_bg"

And applied NoActionBar theme to the activity

<activity 
   android:name=".activity.LoginActivity" 
   android:theme="@style/AppTheme.NoActionBar">
</activity>

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>
Amit Nayak
  • 583
  • 1
  • 6
  • 17

3 Answers3

0

Try this.

<style name="AppTheme" parent="AppTheme.Base">
        <item name="android:windowTranslucentStatus">true</item>
</style>
ASN
  • 1,655
  • 4
  • 24
  • 52
0

try this (it will only change your title bar color):

 <style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <item name="colorPrimaryDark">@color/colorXYZ</item>
    </style>
Fazan Cheng
  • 866
  • 1
  • 8
  • 13
0

To Change Window Title bar Color :

Window window = activity.getWindow();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            window.setStatusBarColor(ContextCompat.getColor(activity, R.color.yourColor));
        }

for api<21 , :

<resources>
    <style name="AppTheme" parent="android:Theme.Material">
        <!-- Customize your theme using Material Design here. -->
        <!-- Title Bar color here -->
        <item name="android:colorPrimary">#YOUR_COLOR_HERE</item>
        <!-- Background color here -->
        <item name="android:windowBackground">#YOUR_COLOR_HERE</item>
    </style>
</resources>
Shiva Snape
  • 544
  • 5
  • 9