沉浸式

 1 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {  2             int flagTranslucentStatus = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;  3             int flagTranslucentNavigation = WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;  4             if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {  5                 Window window = getWindow();  6                 WindowManager.LayoutParams attributes = window.getAttributes();  7                 attributes.flags |= flagTranslucentNavigation;  8  window.setAttributes(attributes);  9  getWindow().setStatusBarColor(Color.TRANSPARENT); 10             } else { 11                 Window window = getWindow(); 12                 WindowManager.LayoutParams attributes = window.getAttributes(); 13                 attributes.flags |= flagTranslucentStatus | flagTranslucentNavigation; 14  window.setAttributes(attributes); 15  } 16         }
相關文章
相關標籤/搜索