手记

Android开发笔记——透明状态栏与透明虚拟按键

1.以下代码用于设置App是否用同透明状态栏与透明虚拟按键:

(Activity activityisStatusTransisNavigationTrans) {

    (isStatusTrans) {
        (Build.VERSION.>= Build.VERSION_CODES.) {
            activity.getWindow().addFlags(WindowManager.LayoutParams.)}

        (Build.VERSION.>= Build.VERSION_CODES.) {
            Window window = activity.getWindow()window.clearFlags(WindowManager.LayoutParams.)window.getDecorView().setSystemUiVisibility(View.| View.)window.addFlags(WindowManager.LayoutParams.)window.setStatusBarColor(Color.)}
    }

    (isNavigationTrans) {
        (Build.VERSION.>= Build.VERSION_CODES.) {
            activity.getWindow().addFlags(WindowManager.LayoutParams.)}

        (Build.VERSION.>= Build.VERSION_CODES.) {
            Window window = activity.getWindow()window.clearFlags(WindowManager.LayoutParams.)window.getDecorView().setSystemUiVisibility(View.| View.)window.addFlags(WindowManager.LayoutParams.)window.setNavigationBarColor(Color.)}
    }
}

该方法调用需要在Activity onCreate方法中使用,而且需要在setContentView之前调用。

原文链接:http://www.apkbus.com/blog-184446-78102.html

0人推荐
随时随地看视频
慕课网APP