kandi background
Explore Kits

SystemBarTint | Apply background tinting to the Android system UI | User Interface library

 by   jgilfelt Java Version: v1.0.3 License: Apache-2.0

 by   jgilfelt Java Version: v1.0.3 License: Apache-2.0

Download this library from

kandi X-RAY | SystemBarTint Summary

SystemBarTint is a Java library typically used in User Interface applications. SystemBarTint has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can download it from GitHub, Maven.
Apply background tinting to the Android system UI when using KitKat translucent modes. Android 4.4 (KitKat) introduced translucent system UI styling for status and navigation bars. These styles are great for wallpaper based activities like the home screen launcher, but the minimal background protection provided makes them less useful for other types of activity unless you supply your own backgrounds inside your layout. Determining the size, position and existence of the system UI for a given device configuration can be non-trivial. This library offers a simple way to create a background "tint" for the system bars, be it a color value or Drawable. By default it will give you a semi-opaque black background that will be useful for full-bleed content screens where persistent system UI is still important - like when placed over a map or photo grid.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • SystemBarTint has a medium active ecosystem.
  • It has 5397 star(s) with 1500 fork(s). There are 232 watchers for this library.
  • It had no major release in the last 12 months.
  • SystemBarTint has no issues reported. There are 3 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of SystemBarTint is v1.0.3
SystemBarTint Support
Best in #User Interface
Average in #User Interface
SystemBarTint Support
Best in #User Interface
Average in #User Interface

quality kandi Quality

  • SystemBarTint has 0 bugs and 0 code smells.
SystemBarTint Quality
Best in #User Interface
Average in #User Interface
SystemBarTint Quality
Best in #User Interface
Average in #User Interface

securitySecurity

  • SystemBarTint has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • SystemBarTint code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
SystemBarTint Security
Best in #User Interface
Average in #User Interface
SystemBarTint Security
Best in #User Interface
Average in #User Interface

license License

  • SystemBarTint is licensed under the Apache-2.0 License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
SystemBarTint License
Best in #User Interface
Average in #User Interface
SystemBarTint License
Best in #User Interface
Average in #User Interface

buildReuse

  • SystemBarTint releases are available to install and integrate.
  • Deployable package is available in Maven.
  • Build file is available. You can build the component from source.
  • Installation instructions, examples and code snippets are available.
  • SystemBarTint saves you 380 person hours of effort in developing the same functionality from scratch.
  • It has 906 lines of code, 64 functions and 17 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
SystemBarTint Reuse
Best in #User Interface
Average in #User Interface
SystemBarTint Reuse
Best in #User Interface
Average in #User Interface
Top functions reviewed by kandi - BETA

kandi has reviewed SystemBarTint and discovered the below as its top functions. This is intended to give you an instant insight into SystemBarTint implemented functionality, and help decide if they suit your requirements.

  • Draws the color wheel .
  • Initialize the gradient
  • Setup the navigation bar .
  • Initializes the activity bar .
  • Setup the status bar view .
  • Apply selected color .
  • Restore the selected state from the Bundle .
  • Called when a list item is clicked .

SystemBarTint Key Features

[DEPRECATED] Apply background tinting to the Android system UI when using KitKat translucent modes

Usage

copy iconCopydownload iconDownload
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    // create our manager instance after the content view is set
    SystemBarTintManager tintManager = new SystemBarTintManager(this);
    // enable status bar tint
    tintManager.setStatusBarTintEnabled(true);
    // enable navigation bar tint
    tintManager.setNavigationBarTintEnabled(true);
}

Setup

copy iconCopydownload iconDownload
dependencies {
    compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
}

License

copy iconCopydownload iconDownload
Copyright 2013 readyState Software Limited

how to set status bar background as gradient color or a drawable in android

copy iconCopydownload iconDownload
 @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    public static void setStatusBarGradiant(Activity activity) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = activity.getWindow();
            Drawable background = activity.getResources().getDrawable(R.drawable.gradient_theme);
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.setStatusBarColor(activity.getResources().getColor(android.R.color.transparent));
            window.setNavigationBarColor(activity.getResources().getColor(android.R.color.transparent));
            window.setBackgroundDrawable(background);
        }
    } 
<style name="AppTheme.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>
-----------------------
 @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    public static void setStatusBarGradiant(Activity activity) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = activity.getWindow();
            Drawable background = activity.getResources().getDrawable(R.drawable.gradient_theme);
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.setStatusBarColor(activity.getResources().getColor(android.R.color.transparent));
            window.setNavigationBarColor(activity.getResources().getColor(android.R.color.transparent));
            window.setBackgroundDrawable(background);
        }
    } 
<style name="AppTheme.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>
-----------------------
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
fun backGroundColor() {
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
    window.statusBarColor = ContextCompat.getColor(this, android.R.color.transparent)
    window.navigationBarColor = ContextCompat.getColor(this, android.R.color.transparent)
    window.setBackgroundDrawableResource(R.drawable.ic_drawable_vertical_background)
}
-----------------------
public class StatusBarView extends View
{
    private int mStatusBarHeight;

    public StatusBarView(Context context)
    {
        this(context, null);

    }

    public StatusBarView(Context context, AttributeSet attrs)
    {
        super(context, attrs);
        if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
            setSystemUiVisibility(SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
        }
    }

    @Override
    public WindowInsets onApplyWindowInsets(WindowInsets insets)
    {
        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
            mStatusBarHeight = insets.getSystemWindowInsetTop();
            return insets.consumeSystemWindowInsets();
        }
        return insets;
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
    {
        setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec),mStatusBarHeight);
    }
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
        android:type="linear"
        android:angle="135"
        android:endColor="#F34D80"

        android:startColor="#FF5858"/><!--android:centerColor="#C12389"-->
</shape>
<?xml version="1.0" encoding="utf-8"?>
<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="wrap_content"
    android:orientation="vertical">

    <YOURPACKAGENAME.StatusBarView
        android:id="@+id/status_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/toolbar_bg_gradient"/>

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:background="@drawable/toolbar_bg_gradient"
        android:elevation="0dp"
        android:minHeight="?attr/actionBarSize"
        app:contentInsetStartWithNavigation="0dp"
        app:popupTheme="@style/AppTheme.PopupOverlay"
        app:subtitleTextColor="@android:color/white"
        app:theme="@style/AppTheme.AppBarOverlay"
        app:titleTextColor="@android:color/white" />
</LinearLayout>
<style name="AppTheme.NoActionBarMain" parent="Base.Theme.AppCompat.Light">
        <item name="windowActionBar">false</item>
        <item name="android:windowDisablePreview">true</item>
        <item name="windowNoTitle">true</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowEnableSplitTouch">false</item>
        <item name="android:splitMotionEvents">false</item>
        <item name="android:windowDrawsSystemBarBackgrounds" tools:targetApi="lollipop">true</item>
        <item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item>
        <item name="android:colorForeground">@color/foreground_material_light</item>
        <item name="windowActionModeOverlay">true</item>
        <item name="actionModeStyle">@style/LywActionMode</item>
    </style>

<style name="LywActionMode" parent="Base.Widget.AppCompat.ActionMode">
        <item name="background">@color/colorPrimary</item>
        <item name="backgroundSplit">@color/colorPrimary</item>
    </style>
-----------------------
public class StatusBarView extends View
{
    private int mStatusBarHeight;

    public StatusBarView(Context context)
    {
        this(context, null);

    }

    public StatusBarView(Context context, AttributeSet attrs)
    {
        super(context, attrs);
        if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
            setSystemUiVisibility(SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
        }
    }

    @Override
    public WindowInsets onApplyWindowInsets(WindowInsets insets)
    {
        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
            mStatusBarHeight = insets.getSystemWindowInsetTop();
            return insets.consumeSystemWindowInsets();
        }
        return insets;
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
    {
        setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec),mStatusBarHeight);
    }
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
        android:type="linear"
        android:angle="135"
        android:endColor="#F34D80"

        android:startColor="#FF5858"/><!--android:centerColor="#C12389"-->
</shape>
<?xml version="1.0" encoding="utf-8"?>
<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="wrap_content"
    android:orientation="vertical">

    <YOURPACKAGENAME.StatusBarView
        android:id="@+id/status_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/toolbar_bg_gradient"/>

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:background="@drawable/toolbar_bg_gradient"
        android:elevation="0dp"
        android:minHeight="?attr/actionBarSize"
        app:contentInsetStartWithNavigation="0dp"
        app:popupTheme="@style/AppTheme.PopupOverlay"
        app:subtitleTextColor="@android:color/white"
        app:theme="@style/AppTheme.AppBarOverlay"
        app:titleTextColor="@android:color/white" />
</LinearLayout>
<style name="AppTheme.NoActionBarMain" parent="Base.Theme.AppCompat.Light">
        <item name="windowActionBar">false</item>
        <item name="android:windowDisablePreview">true</item>
        <item name="windowNoTitle">true</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowEnableSplitTouch">false</item>
        <item name="android:splitMotionEvents">false</item>
        <item name="android:windowDrawsSystemBarBackgrounds" tools:targetApi="lollipop">true</item>
        <item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item>
        <item name="android:colorForeground">@color/foreground_material_light</item>
        <item name="windowActionModeOverlay">true</item>
        <item name="actionModeStyle">@style/LywActionMode</item>
    </style>

<style name="LywActionMode" parent="Base.Widget.AppCompat.ActionMode">
        <item name="background">@color/colorPrimary</item>
        <item name="backgroundSplit">@color/colorPrimary</item>
    </style>
-----------------------
public class StatusBarView extends View
{
    private int mStatusBarHeight;

    public StatusBarView(Context context)
    {
        this(context, null);

    }

    public StatusBarView(Context context, AttributeSet attrs)
    {
        super(context, attrs);
        if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
            setSystemUiVisibility(SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
        }
    }

    @Override
    public WindowInsets onApplyWindowInsets(WindowInsets insets)
    {
        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
            mStatusBarHeight = insets.getSystemWindowInsetTop();
            return insets.consumeSystemWindowInsets();
        }
        return insets;
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
    {
        setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec),mStatusBarHeight);
    }
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
        android:type="linear"
        android:angle="135"
        android:endColor="#F34D80"

        android:startColor="#FF5858"/><!--android:centerColor="#C12389"-->
</shape>
<?xml version="1.0" encoding="utf-8"?>
<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="wrap_content"
    android:orientation="vertical">

    <YOURPACKAGENAME.StatusBarView
        android:id="@+id/status_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/toolbar_bg_gradient"/>

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:background="@drawable/toolbar_bg_gradient"
        android:elevation="0dp"
        android:minHeight="?attr/actionBarSize"
        app:contentInsetStartWithNavigation="0dp"
        app:popupTheme="@style/AppTheme.PopupOverlay"
        app:subtitleTextColor="@android:color/white"
        app:theme="@style/AppTheme.AppBarOverlay"
        app:titleTextColor="@android:color/white" />
</LinearLayout>
<style name="AppTheme.NoActionBarMain" parent="Base.Theme.AppCompat.Light">
        <item name="windowActionBar">false</item>
        <item name="android:windowDisablePreview">true</item>
        <item name="windowNoTitle">true</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowEnableSplitTouch">false</item>
        <item name="android:splitMotionEvents">false</item>
        <item name="android:windowDrawsSystemBarBackgrounds" tools:targetApi="lollipop">true</item>
        <item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item>
        <item name="android:colorForeground">@color/foreground_material_light</item>
        <item name="windowActionModeOverlay">true</item>
        <item name="actionModeStyle">@style/LywActionMode</item>
    </style>

<style name="LywActionMode" parent="Base.Widget.AppCompat.ActionMode">
        <item name="background">@color/colorPrimary</item>
        <item name="backgroundSplit">@color/colorPrimary</item>
    </style>
-----------------------
public class StatusBarView extends View
{
    private int mStatusBarHeight;

    public StatusBarView(Context context)
    {
        this(context, null);

    }

    public StatusBarView(Context context, AttributeSet attrs)
    {
        super(context, attrs);
        if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
            setSystemUiVisibility(SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
        }
    }

    @Override
    public WindowInsets onApplyWindowInsets(WindowInsets insets)
    {
        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
            mStatusBarHeight = insets.getSystemWindowInsetTop();
            return insets.consumeSystemWindowInsets();
        }
        return insets;
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
    {
        setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec),mStatusBarHeight);
    }
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
        android:type="linear"
        android:angle="135"
        android:endColor="#F34D80"

        android:startColor="#FF5858"/><!--android:centerColor="#C12389"-->
</shape>
<?xml version="1.0" encoding="utf-8"?>
<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="wrap_content"
    android:orientation="vertical">

    <YOURPACKAGENAME.StatusBarView
        android:id="@+id/status_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/toolbar_bg_gradient"/>

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:background="@drawable/toolbar_bg_gradient"
        android:elevation="0dp"
        android:minHeight="?attr/actionBarSize"
        app:contentInsetStartWithNavigation="0dp"
        app:popupTheme="@style/AppTheme.PopupOverlay"
        app:subtitleTextColor="@android:color/white"
        app:theme="@style/AppTheme.AppBarOverlay"
        app:titleTextColor="@android:color/white" />
</LinearLayout>
<style name="AppTheme.NoActionBarMain" parent="Base.Theme.AppCompat.Light">
        <item name="windowActionBar">false</item>
        <item name="android:windowDisablePreview">true</item>
        <item name="windowNoTitle">true</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowEnableSplitTouch">false</item>
        <item name="android:splitMotionEvents">false</item>
        <item name="android:windowDrawsSystemBarBackgrounds" tools:targetApi="lollipop">true</item>
        <item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item>
        <item name="android:colorForeground">@color/foreground_material_light</item>
        <item name="windowActionModeOverlay">true</item>
        <item name="actionModeStyle">@style/LywActionMode</item>
    </style>

<style name="LywActionMode" parent="Base.Widget.AppCompat.ActionMode">
        <item name="background">@color/colorPrimary</item>
        <item name="backgroundSplit">@color/colorPrimary</item>
    </style>
-----------------------
final ActionBar ab = getSupportActionBar();
    if (ab != null) {
        Drawable gradientBG = getResources().getDrawable( R.drawable.bg_transperant);
        ab.setBackgroundDrawable(gradientBG);
    }
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle">
       <solid android:color="@android:color/transparent" />
</shape>
-----------------------
final ActionBar ab = getSupportActionBar();
    if (ab != null) {
        Drawable gradientBG = getResources().getDrawable( R.drawable.bg_transperant);
        ab.setBackgroundDrawable(gradientBG);
    }
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle">
       <solid android:color="@android:color/transparent" />
</shape>
-----------------------
<android.support.v4.widget.DrawerLayout
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:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
tools:openDrawer="start">

<include
    layout="@layout/app_bar_navigation"
    android:fitsSystemWindows="true"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<android.support.design.widget.NavigationView
    android:id="@+id/nav_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:fitsSystemWindows="true"
    app:headerLayout="@layout/nav_header_navigation"
    app:menu="@menu/activity_navigation_drawer" />
-----------------------
window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
-----------------------
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
        android:type="linear"
        android:angle="0"
        android:startColor="#11998e"
        android:endColor="#38ef7d" />
</shape>
<item name="android:windowBackground">@drawable/bg_toolbar</item>
<item name="toolbarStyle">@style/Widget.Toolbar</item>
<item name="android:statusBarColor">#00000000</item>
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Widget.Toolbar" parent="@style/Widget.AppCompat.Toolbar">
        <item name="contentInsetStart">0dp</item>
        <item name="android:background">@drawable/bg_toolbar</item>
    </style>
</resources> 
-----------------------
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
        android:type="linear"
        android:angle="0"
        android:startColor="#11998e"
        android:endColor="#38ef7d" />
</shape>
<item name="android:windowBackground">@drawable/bg_toolbar</item>
<item name="toolbarStyle">@style/Widget.Toolbar</item>
<item name="android:statusBarColor">#00000000</item>
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Widget.Toolbar" parent="@style/Widget.AppCompat.Toolbar">
        <item name="contentInsetStart">0dp</item>
        <item name="android:background">@drawable/bg_toolbar</item>
    </style>
</resources> 
-----------------------
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
        android:type="linear"
        android:angle="0"
        android:startColor="#11998e"
        android:endColor="#38ef7d" />
</shape>
<item name="android:windowBackground">@drawable/bg_toolbar</item>
<item name="toolbarStyle">@style/Widget.Toolbar</item>
<item name="android:statusBarColor">#00000000</item>
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Widget.Toolbar" parent="@style/Widget.AppCompat.Toolbar">
        <item name="contentInsetStart">0dp</item>
        <item name="android:background">@drawable/bg_toolbar</item>
    </style>
</resources> 
-----------------------
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowBackground">@drawable/backfull</item>
    <item name="android:windowActionBar">false</item>

    <item name="android:windowActionModeOverlay">true</item>
    <item name="windowActionModeOverlay">true</item>

</style>

<style name="AppTheme2" parent="AppTheme.Base">
    <item name="colorPrimary">@drawable/backfull</item>
    <item name="colorPrimaryDark">@android:color/white</item>>
    <item name="colorAccent">@android:color/black</item>
    <item name="colorButtonNormal">@android:color/white</item>
</style>

<style name="ToolbarTheme" parent="Widget.AppCompat.Toolbar">
    <item name="android:background">@drawable/backfull</item>
    <item name="background">@android:color/black</item>
    <item name="titleTextAppearance">@style/ToolbarTitleTheme</item>
    <item name="popupTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
    <item name="theme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
</style>

<style name="ToolbarTitleTheme">
    <item name="android:textColor">@android:color/holo_red_dark</item>
    <item name="android:textStyle">bold</item>
</style>

How to set Status bar to white background and black text (black icon) in my cordova app

copy iconCopydownload iconDownload
<preference name="StatusBarBackgroundColor" value="#FFFFFF" />
<preference name="StatusBarStyle" value="default" />
-----------------------
<preference name="StatusBarBackgroundColor" value="#FFFFFF" />
<preference name="StatusBarStyle" value="default" />

Trying to build on Android

copy iconCopydownload iconDownload
android {
  // everything else
  dexOptions {
    preDexLibraries = false
  }
}

Error:Execution failed for task ':mobile:processDebugResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt

copy iconCopydownload iconDownload
Error:(76, 0) No such property: bootClasspath for class: com.android.build.gradle.AppPlugin

When I try to generate app, following error produce

copy iconCopydownload iconDownload
compile 'com.google.android.gms:play-services-ads:11.0.2'
compile 'com.google.android.gms:play-services-basement:11.0.2' 
compile 'com.google.android.gms:play-services-location:11.0.2' 
-----------------------
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:appcompat-v7:26.+'
-----------------------
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:appcompat-v7:26.+'
-----------------------
+--- com.adobe.creativesdk:image:4.8.4
|    +--- com.google.android.gms:play-services-gcm:9.4.0 // conflict here
|    |    +--- com.google.android.gms:play-services-base:9.4.0 -> 11.0.1 (*)
|    |    +--- com.google.android.gms:play-services-basement:9.4.0 -> 11.0.1 (*)
|    |    \--- com.google.android.gms:play-services-iid:9.4.0 // conflict here
|    |         +--- com.google.android.gms:play-services-base:9.4.0 -> 11.0.1 (*)
|    |         \--- com.google.android.gms:play-services-basement:9.4.0 -> 11.0.1 (*)
-----------------------
  compile 'com.google.android.gms:play-services-ads-lite:10.2.0'
  compile 'com.google.android.gms:play-services-basement:10.2.0'
  compile 'com.google.android.gms:play-services-location:10.2.0' 
classpath 'com.google.gms:google-services:3.1.0'
-----------------------
  compile 'com.google.android.gms:play-services-ads-lite:10.2.0'
  compile 'com.google.android.gms:play-services-basement:10.2.0'
  compile 'com.google.android.gms:play-services-location:10.2.0' 
classpath 'com.google.gms:google-services:3.1.0'

Android toolbar navigationg and system bar ? API 19

copy iconCopydownload iconDownload
<style name="DayTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/primary</item>
        <item name="colorPrimaryDark">@color/primary_dark</item>
        <item name="colorAccent">@color/accent</item>
        <item name="background">@color/white</item>
        <item name="barTitleColor">@color/bar_title</item>
        <item name="barColor">@color/primary</item>
        <item name="textColor">@color/text_color</item>
        <item name="textLight">@color/text_light</item>
        <item name="textBright">@color/primary</item>
        <item name="dividerColor">@color/dividerColor</item>

    </style>
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <attr name="barTitleColor" format="color"/>
    <attr name="textColor" format="color"/>
    <attr name="textLight" format="color"/>
    <attr name="textBright" format="color"/>
    <attr name="dividerColor" format="color"/>
    <attr name="barColor" format="color"/>
</resources>
<?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:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true"
        android:background="?attr/barColor"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        >

        <android.support.v7.widget.Toolbar
            app:contentInsetStart="0dp"
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/colorPrimary"
            android:minHeight="?attr/actionBarSize"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            />

</android.support.design.widget.AppBarLayout>
android:background="?attr/barColor"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
-----------------------
<style name="DayTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/primary</item>
        <item name="colorPrimaryDark">@color/primary_dark</item>
        <item name="colorAccent">@color/accent</item>
        <item name="background">@color/white</item>
        <item name="barTitleColor">@color/bar_title</item>
        <item name="barColor">@color/primary</item>
        <item name="textColor">@color/text_color</item>
        <item name="textLight">@color/text_light</item>
        <item name="textBright">@color/primary</item>
        <item name="dividerColor">@color/dividerColor</item>

    </style>
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <attr name="barTitleColor" format="color"/>
    <attr name="textColor" format="color"/>
    <attr name="textLight" format="color"/>
    <attr name="textBright" format="color"/>
    <attr name="dividerColor" format="color"/>
    <attr name="barColor" format="color"/>
</resources>
<?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:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true"
        android:background="?attr/barColor"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        >

        <android.support.v7.widget.Toolbar
            app:contentInsetStart="0dp"
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/colorPrimary"
            android:minHeight="?attr/actionBarSize"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            />

</android.support.design.widget.AppBarLayout>
android:background="?attr/barColor"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
-----------------------
<style name="DayTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/primary</item>
        <item name="colorPrimaryDark">@color/primary_dark</item>
        <item name="colorAccent">@color/accent</item>
        <item name="background">@color/white</item>
        <item name="barTitleColor">@color/bar_title</item>
        <item name="barColor">@color/primary</item>
        <item name="textColor">@color/text_color</item>
        <item name="textLight">@color/text_light</item>
        <item name="textBright">@color/primary</item>
        <item name="dividerColor">@color/dividerColor</item>

    </style>
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <attr name="barTitleColor" format="color"/>
    <attr name="textColor" format="color"/>
    <attr name="textLight" format="color"/>
    <attr name="textBright" format="color"/>
    <attr name="dividerColor" format="color"/>
    <attr name="barColor" format="color"/>
</resources>
<?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:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true"
        android:background="?attr/barColor"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        >

        <android.support.v7.widget.Toolbar
            app:contentInsetStart="0dp"
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/colorPrimary"
            android:minHeight="?attr/actionBarSize"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            />

</android.support.design.widget.AppBarLayout>
android:background="?attr/barColor"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
-----------------------
<style name="DayTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/primary</item>
        <item name="colorPrimaryDark">@color/primary_dark</item>
        <item name="colorAccent">@color/accent</item>
        <item name="background">@color/white</item>
        <item name="barTitleColor">@color/bar_title</item>
        <item name="barColor">@color/primary</item>
        <item name="textColor">@color/text_color</item>
        <item name="textLight">@color/text_light</item>
        <item name="textBright">@color/primary</item>
        <item name="dividerColor">@color/dividerColor</item>

    </style>
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <attr name="barTitleColor" format="color"/>
    <attr name="textColor" format="color"/>
    <attr name="textLight" format="color"/>
    <attr name="textBright" format="color"/>
    <attr name="dividerColor" format="color"/>
    <attr name="barColor" format="color"/>
</resources>
<?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:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true"
        android:background="?attr/barColor"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        >

        <android.support.v7.widget.Toolbar
            app:contentInsetStart="0dp"
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/colorPrimary"
            android:minHeight="?attr/actionBarSize"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            />

</android.support.design.widget.AppBarLayout>
android:background="?attr/barColor"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"

Community Discussions

Trending Discussions on SystemBarTint
  • how to set status bar background as gradient color or a drawable in android
  • Google store new rule Api 23 to 28 why Gradle Update error
  • How to deal with Error: failed linking references
  • How to set Status bar to white background and black text (black icon) in my cordova app
  • Trying to build on Android
  • Error:Execution failed for task ':mobile:processDebugResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt
  • When I try to generate app, following error produce
  • Android toolbar navigationg and system bar ? API 19
  • Fraction types not allowed
Trending Discussions on SystemBarTint

QUESTION

how to set status bar background as gradient color or a drawable in android

Asked 2019-Jul-26 at 15:33

I want to set status bar background as gradient theme also status bar and action bar color should same gradient drawable, as per documentation we can set color to status bar in API level 21 and above by using

<item name="android:statusBarColor">@color/colorPrimary</item>

But i am searching something like

<item name="android:statusBarDrawable">@drawable/myDrawable</item>

I have seen example that use

 <item name="android:windowTranslucentStatus">false</item>
   <item name="android:windowTranslucentNavigation">false</item>

but in that case status bar and action bar overlap (use fitSystemWindow =true but still not solved) also try with https://github.com/jgilfelt/SystemBarTint this library but still no luck

Thank you in advance!!

ANSWER

Answered 2018-Feb-19 at 05:51

enter image description hereFor some one who want to set gradient color to status bar background you can use following method in your activity before setContentView()

 @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    public static void setStatusBarGradiant(Activity activity) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = activity.getWindow();
            Drawable background = activity.getResources().getDrawable(R.drawable.gradient_theme);
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.setStatusBarColor(activity.getResources().getColor(android.R.color.transparent));
            window.setNavigationBarColor(activity.getResources().getColor(android.R.color.transparent));
            window.setBackgroundDrawable(background);
        }
    } 

Thanks every one for your help

EDIT

If the above code don't work, try to add this in your styles.xml:

<style name="AppTheme.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

Source https://stackoverflow.com/questions/43140039

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install SystemBarTint

Download and include the [JAR][1] in your project, or add the dependency in your build.gradle:.

Support

For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Explore Related Topics

Share this Page

share link
Compare User Interface Libraries with Highest Quality
Compare User Interface Libraries with Highest Security
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.