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之前调用。