android任务栏工具,系统栏工具库 - 状态栏/导航栏

SystemBars

系统栏工具库

设置系统栏背景色

设置覆盖在应用内容上

设置系统栏浅色模式

设置是否在系统栏颜色为0时,显示默认的系统栏半透明背景

设置沉浸式系统栏

向后倾斜模式 - 触摸屏幕重新显示系统栏

沉浸模式 - 滑过屏幕边缘重新显示系统栏

粘性沉浸模式 - 滑过屏幕边缘重新显示系统栏并在数秒后重新隐藏,此方式无法收到系统栏的可见性变化事件

适配 Android R(API30)

最低要求 API21+

Gradle

repositories {

maven { url "https://gitee.com/ezy/repo/raw/android_public/"}

}

dependencies {

implementation "me.reezy.jetpack:systembars:0.4.0"

}

API

interface Bar {

// 设置系统栏背景色

fun color(@ColorInt color: Int): Bar

// 设置覆盖在应用内容上

fun overlay(value: Boolean = true): Bar

// 设置系统栏浅色模式

fun light(value: Boolean = true): Bar

// 设置是否在系统纺栏颜色为0时,显示默认的系统栏半透明背景

fun contrast(value: Boolean = true): Bar

}

fun Activity.systemBars(): Bar = SystemBars(window)

fun Fragment.systemBars(): Bar = SystemBars(requireActivity().window)

fun Dialog.systemBars(): Bar = SystemBars(window!!)

fun Activity.statusBar(): Bar = StatusBar(window)

fun Fragment.statusBar(): Bar = StatusBar(requireActivity().window)

fun Dialog.statusBar(): Bar = StatusBar(window!!)

fun Activity.navigationBar(): Bar = NavigationBar(window)

fun Fragment.navigationBar(): Bar = NavigationBar(requireActivity().window)

fun Dialog.navigationBar(): Bar = NavigationBar(window!!)

fun Window.immersive(enable: Boolean = true, swipe: Boolean = false, transientBars: Boolean = false)

var Window.isDrawsSystemBarBackgrounds: Boolean

var Window.isStatusBarOverlay: Boolean

var Window.isStatusBarLight: Boolean

var Window.isNavigationBarOverlay: Boolean

var Window.isNavigationBarLight: Boolean

Screenshot

fcf1752d174b98a6a2798707d441c8f4.png

LICENSE

The Component is open-sourced software licensed under the Apache license.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值