GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - fython/MaterialStatusBarCompat: Easy to make status bar translucent/tint on both Kitkat and Lollipop (完美地使 Kitkat 与 Lollipop 上的状态栏同时透明/变色)

BranchesTags
Open more actions menu

Latest commit

 

History

6 Commits
6 Commits

Folders and files

NameName
Last commit message
Last commit date
app
app
 
 
art
art
 
 
demo-java
demo-java
 
 
gradle/wrapper
gradle/wrapper
 
 
library-java
library-java
 
 
library-kotlin
library-kotlin
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

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 在布局中添加 StatusBarHeaderView 到 Toolbar 上面

<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 AppBarLayout 将 Toolbar 和其他应当作为 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. 

About

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

Resources

Readme
Apache-2.0 license
Activity

Stars

261 stars

Watchers

15 watching

Forks

40 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.