• Stars
    star
    263
  • Rank 155,624 (Top 4 %)
  • Language
    Kotlin
  • License
    Apache License 2.0
  • Created over 9 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Easy to make status bar translucent/tint on both Kitkat and Lollipop (完美地使 Kitkat 与 Lollipop 上的状态栏同时透明/变色)

MaterialStatusBarCompat

Easy to make status bar translucent/tint on both Kitkat and Lollipop 完美地使 Kitkat 与 Lollipop 上的状态栏同时透明/变色

第一个版本只有 Kotlin 版本,是作为 Hello, Kotlin! 的存在。 考虑到 Kotlin 在 Android 使用会增大安装包体积,稍后会推出 Java 版本。

Tips: It may not be compatibled with Android Support Design Library. 提示:不保证和 Android Support Design Library 兼容。(我也不打算兼容因为我很讨厌它很多奇葩问题)

Screenshots 截图

Lollipop LPBlue LPDeepPurple

Kitkat KKBlue KKDeepPurple

Usage 用法

Step 0 第一步

First, use Theme.AppCompat.*.TranslucentStatusBar instead of Theme.AppCompat.* 首先,采用 Theme.AppCompat.*.TranslucentStatusBar 主题代替 Theme.AppCompat.*

Step 1 第二步

Then, modify your Java/Kotlin code by these ways. 接着,根据这些方法修改你的 Java/Kotlin 中的 Activity 部分

Way 0 方法一:

Call StatusBarCompat.setUpActivity(this) before setContentView() in your activites 在你的 Activity 中调用 setContentView() 之前调用 StatusBarCompat.setUpActivity(this)

Java code:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    StatusBarCompat.setUpActivity(this);
    setContentView(R.layout.activity_xxxxx);
}

Kotlin code:

override public fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    StatusBarCompat().setUpActivity(this)
    setContentView(R.layout.activity_xxxxx)
}

Way 1 方法二:

Use TranslucentSBActivity instead of AppCompatActivity 使用 TranslucentSBActivity 代替 AppCompatActivity

Step 2 第三步

Way 0 方法一:

Add StatusBarHeaderView above Toolbar in layout 在布局中添加 StatusBarHeaderViewToolbar 上面

<LinearLayout
    ...
    android:orientation="vertical"/>
        <moe.feng.material.statusbar.StatusBarHeaderView
            android:layout_height="0dp"
            android:layout_width="match_parent"
            app:colorNormal="@color/colorForKitkat"
            app:colorDark="@color/colorForLollipop"/>
        <android.support.v7.widget.Toolbar
            .../>
</LinearLayout>

Way 1 方法二:

Put Toolbar and other views which should be a part of appbar (Such as TabLayout) in AppBarLayoutToolbar 和其他应当作为 App 顶栏一部分的 View (比如 Tab 栏) 放在 AppBarLayout

PS: AppBarLayout is based on a vertical LinearLayout(AppBarLayout 基于垂直方向的 LinearLayout)

<moe.feng.material.statusbar.AppBarLayout
    ...
    app:colorNormal="@color/colorForKitkat"
    app:colorDark="@color/colorForLollipop"/>
        <android.support.v7.widget.Toolbar
            .../>
</LinearLayout>
Step 3 第三步

Finish! You also can change their color in Java/Kotlin code. 没有第三步了!你也可以在 Java/Kotlin 代码中随时更改它们的颜色。

Contact me 联系我

Google Plus: +Fung Jichun 新浪微博: @某燒餅 我的 Android 开发交流群: 34725246

支持项目

Alipay 支付宝: [email protected]

License 开源协议

Copyright 2015 FengMoe

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. 

More Repositories

1

BilibiliAPIDocs

哔哩哔哩开放接口第三方文档(仅提供官方曾公开接口)
2,395
star
2

MaterialStepperView

Steppers - Material Design Components for Android
Java
2,194
star
3

Blackbulb

Night Screen - Material Design Screen Filter
Java
341
star
4

PackageTracker

Track your package simply on Android.
Kotlin
339
star
5

BreadcrumbsView

Material Design Breadcrumbs Navigation Widget on Android
Java
296
star
6

AlipayZeroSdk

Lightest Alipay Transfer Helper - 最轻量的支付宝转账工具类(Android)
Java
293
star
7

BiometricPromptCompat

A Thrid-party BiometricPrompt compat library.
Java
263
star
8

EnhancedScreenshotNotification

Enhanced Screenshot Notification (Nevolution Decorator)
Java
72
star
9

Kotlinyan

[Deprecated] Make Kotlin Android app development easier and more elegant
Kotlin
67
star
10

kotlin-guides-cn

Android Kotlin Guides 网站(Fork 自 android/kotlin-guides)的第三方简体中文翻译
CSS
49
star
11

ImageGridView

Help you to create a flexible image grid easily.
Java
48
star
12

PackageTracker-NodeServer

Package Tracker (Node.js) Server for third-party api support and fcm push
JavaScript
41
star
13

userscript-enhance-bilibili-player

增强哔哩哔哩播放器的使用体验(Tampermonkey script)
JavaScript
35
star
14

KotlinaGallery

Build multiplatform(JVM/JS) ACG Gallery application with Kotlin
Kotlin
30
star
15

To-Watch-Bangumi-List

烧饼的补番列表 My TO-WATCH Bangumi List
30
star
16

vscode-gwo-android-helper

Browse files on your Android devices with Visual Studio Code
TypeScript
27
star
17

MaterialPreferenceCompat

Use android.support.v7.app.AlertDialog on your Preferences
Java
26
star
18

ExpressHelper

Please move to the new Package Tracker
Java
22
star
19

AnotherEChan

OneEChan (https://github.com/Tlaster/OneEchan) Thrid-Party Android Application
Java
18
star
20

Aoba-TelegramBot

Aoba Telegram Bot written in Kotlin
Kotlin
18
star
21

MacType-SourceHanSerif

Source Han Serif MacType Config
15
star
22

MaterialColorUtils

Get Material colors easily programmatically or in xml.
Kotlin
11
star
23

InvalidMediaCleaner

Scan and clean invalid media on your Android
Java
11
star
24

NyanAndroidArch

(自用) My Android architecture library in Kotlin. Enjoy the convenience of data binding and MVVM mode.
Kotlin
10
star
25

GDGaoKaoQuery-Android

广东高考录取结果查询 Android 端 (Kotlin)
Kotlin
9
star
26

bili-downloader

B 站视频批量下载库
TypeScript
8
star
27

PackageTracker-KotlinServer

[WIP] Package Tracker Push Server for Kotlin
Kotlin
7
star
28

LuSpeed

How fast do you "lu"?
Java
7
star
29

TelegramVisualNovelBot

Play Visual Novel Game on Telegram!
Python
6
star
30

SCUTAutoWiFi-Android

SCUT AutoWiFi Client for Android (Kotlin Lang)
Kotlin
6
star
31

AutoFiles

(WIP)
Java
6
star
32

about-me-page

About me page. Powered by Vue + Vuetify
CSS
5
star
33

YeelightAPI

(Personal use; Unfinished) Java implementation of Yeelight official API
Java
3
star
34

Python_Practice_DMZJ_API

DMZJ Client Api
Python
3
star
35

EventsHelper

EventBus-like utility based on annotation processors
Java
2
star
36

bili-open-live-go

哔哩哔哩直播长连协议客户端 Golang 版本
Go
2
star
37

userscript-weibo-link-go

新浪微博外链自动跳转
JavaScript
2
star
38

heartsteel-web

Heartsteel web emulator from League of Legends
Vue
1
star
39

SCUTAutoWiFi-Python

Just a simple python program
Python
1
star
40

apitest

DO NOT star this repo. Thx
1
star