Android 沉浸式通知栏

Android沉浸式通知栏的两种方式


一,

requestWindowFeature(Window.FEATURE_NO_TITLE);// 不显示标题
Window window = getWindow();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    // 沉浸通知栏
    window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
            WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

}
二,

自定义

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name="android:statusBarColor">@android:color/transparent</item>
</style>

清单文件

android:theme="@style/AppTheme.NoActionBar"

猜你喜欢

转载自blog.csdn.net/u013800308/article/details/52233730
今日推荐