explaingit

laobie/statusbarutil

8,760JavaAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

StatusBarUtil is a small Android library that lets you set the color, transparency, or icon style of the Android status bar with a single method call, working back to Android 4.4.

Mindmap

mindmap
  root((StatusBarUtil))
    What it does
      Set solid color
      Translucent tint
      Fully transparent
    Icon styles
      Light mode icons
      Dark mode icons
    Layout support
      Navigation drawer
      Image header
      ViewPager fragments
    Setup
      Gradle dependency
      Static method calls
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Set a custom status bar color to match your app's toolbar without writing per-API-level boilerplate code.

USE CASE 2

Make the status bar fully transparent so a hero image or gradient extends behind it on a detail screen.

USE CASE 3

Switch the status bar to light mode so dark icons are visible against a light-colored top area.

USE CASE 4

Handle status bar styling correctly on screens with a navigation drawer or a full-bleed image header.

Tech stack

JavaAndroidGradle

Getting it running

Difficulty · easy Time to first run · 5min
Apache 2.0 license, use freely for any purpose, including commercial, as long as you preserve copyright and license notices.

In plain English

StatusBarUtil is a small Android library that makes it easier to style the status bar, the thin strip at the top of an Android phone screen that shows the time, battery level, and notifications. By default Android gives developers limited control over this area, and the rules changed between Android versions. This library smooths that out and works back to Android 4.4 (KitKat). You add it to a project with a single Gradle dependency and then call static methods from your Activity or Fragment code. The available options include setting the status bar to a specific color, making it translucent with a chosen alpha level, making it fully transparent, and switching between light mode (dark icons) and dark mode (light icons). There are also methods for specific layout situations that need extra handling, such as screens that use a navigation drawer, screens where a full-bleed image sits behind the status bar, and screens built with Fragments inside a ViewPager. For fragments and image header layouts, the library inserts a placeholder view that takes up the same height as the status bar so content does not slide underneath it unexpectedly. There is also a method specifically for swipe-back pages, intended for use alongside swipe-to-dismiss gesture libraries. The alpha value for translucency can be adjusted between 0 and 255 depending on how opaque you want the status bar tint to appear. The project includes a sample app demonstrating each feature and screenshots in the README showing how each setting looks on a real device. It is licensed under the Apache License 2.0.

Copy-paste prompts

Prompt 1
Using StatusBarUtil in an Android Java project, show me how to set the status bar color to match the primary toolbar color in a MainActivity.
Prompt 2
How do I make the status bar fully transparent in my Android app so a background image extends behind it? Show the StatusBarUtil call and any layout padding adjustments needed.
Prompt 3
I want to switch between light and dark status bar icon modes based on whether a screen has a light or dark background. How do I do that with StatusBarUtil?
Prompt 4
Show me how to use StatusBarUtil inside a Fragment in a ViewPager to set a different status bar color for each tab.
Prompt 5
My app uses a navigation drawer. How do I configure StatusBarUtil so the drawer slides under a translucent status bar correctly?
Open on GitHub → Explain another repo

← laobie on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.