工具--Fullscreen设置全屏显示

package com.hxzy.notebook.utils;


import android.app.Activity;
import android.view.WindowManager;


public class Fullscreen {


public static void toggleFullscreen(Activity activity,boolean fullScreen) {
// fullScreen为true时全屏,否则相反


WindowManager.LayoutParams attrs = activity.getWindow().getAttributes();


if (fullScreen) {
attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
} else {
attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
}


activity.getWindow().setAttributes(attrs);
}
}

你可能感兴趣的:(工具--Fullscreen设置全屏显示)