Statusbarutils
No description available
Install / Use
/learn @XPGSnail/StatusbarutilsREADME
StatusBarUtil
A util for setting status bar style on Android App. It can work above API 19(KitKat 4.4).

Sample
Change Log
-
1.2.4
fix bug in method
setTransparentForImageViewInFragment -
1.2.3
fix method
setTranslucentForImageViewsupport pass null as needOffsetViewadd method for fragment witch using ImageView as head view
setTranslucentForImageViewInFragment(Activity activity, View needOffsetView) setTransparentForImageViewInFragment(Activity activity, View needOffsetView)fix setTranslucent bug when root layout is CoordinatorLayout
setTranslucentForCoordinatorLayout(Activity activity, int statusBarAlpha) -
1.2.0
add method for page witch using ImageView as head view
setTranslucentForImageView(Activity activity, int statusBarAlpha, View needOffsetView)and
setTranslucentForImageView(Activity activity, View needOffsetView) -
1.1.1
fix set color bug on 4.4 devices
-
1.1.0
fix some bugs
-
1.0.0
first publish
Features
-
Set status bar color
StatusBarUtil.setColor(Activity activity, int color)
-
Set status bar translucent
StatusBarUtil.setTranslucent(Activity activity, int statusBarAlpha)
-
Set status bar transparent
StatusBarUtil.setTransparent(Activity activity)
-
Set status bar color for
DrawerLayoutStatusBarUtil.setColorForDrawerLayout(Activity activity, DrawerLayout drawerLayout, int color)
-
Set translucent status bar for using ImageView as head view page
StatusBarUtil.setTranslucentForImageView(Activity activity, int statusBarAlpha, View needOffsetView)
-
Use in fragment

-
Pass statusBarAlpha param when necessary to change your status bar alpha, which is 112 by default.
Usage
1. Add the dependencies to your build.gradle file, StatusBarUtil is avaiable in JCenter:
compile 'com.jaeger.statusbaruitl:library:1.2.4'
2. Call method you need after setContentView(), such as :
setContentView(R.layout.main_activity);
...
StatusBarUtil.setColor(MainActivity.this, mColor);
3. If you use this util in a page which containing a DrawerLayout, you need add android:fitsSystemWindows="true" for DrawerLayout in your layout XML:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
...
</android.support.v4.widget.DrawerLayout>
4. All statusBarAlpha value you set should between 0 ~ 255
5. How use in Fragment please read UseInFragmentActivity.java
License
Copyright 2016 Jaeger Chen
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Related Skills
node-connect
342.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
85.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
342.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
