//设置窗体全屏
//设置窗体始终点亮
//设置窗体背景模糊
java.lang.Object | ||
? | android.view.ViewGroup.LayoutParams | |
? | android.view.WindowManager.LayoutParams |
主要成员常量
Window flag系列
该系列主要用于对Window的flag进行设置。设置Window的flag,可以直接对Window的getAttributes()得到其 WindowManager.LayoutParams对象,然后直接对它flag变量操作。也可以Window的addFlags(int flags)方法,setFlags(int flags, int mask)方法,clearFlags(int flags)方法进行操作。
比如设置全屏
:
Window window = getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
winParams.flags=winParams.flags|WindowManager.LayoutParams.FLAG_FULLSCREEN
;
或
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
或
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
取消全屏
Window window = getWindow();
winParams.flags=winParams.flags&~WindowManager.LayoutParams.FLAG_FULLSCREEN;
或
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
或
window.setFlags(0, WindowManager.LayoutParams.FLAG_FULLSCREEN);
所有Window flag如下:
int | FLAGS_CHANGED | 用于表示flags发生了变化,关于此的详细内容请看后文。 |
int | FLAG_ALLOW_LOCK_WHILE_SCREEN_ON | Window flag: as long as this window is visible to the user, allow the lock screen to activate while the screen is on. 当该window对用户可见的时候,允许锁屏。 |
int | FLAG_ALT_FOCUSABLE_IM | Window flag: invert the state of FLAG_NOT_FOCUSABLE with respect to how this window interacts with the current method. |
int | FLAG_BLUR_BEHIND | Window flag: blur everything behind this window. 让该window后所有东西都模糊(blur) |
int | FLAG_DIM_BEHIND | Window flag: everything behind this window will be dimmed. 让该window后所有的东西都成暗淡(dim) |
int | FLAG_DISMISS_KEYGUARD | Window flag: when set the window will cause the keyguard to be dismissed, only if it is not a secure lock keyguard. |
int | FLAG_DITHER | Window flag: turn on dithering when compositing this window to the screen. 开启抖动(dithering) |
int | FLAG_FORCE_NOT_FULLSCREEN | Window flag: Override {@link #FLAG_FULLSCREEN and force the screen decorations (such as status bar) to be shown. 恢复window非全屏显示 |
int | FLAG_FULLSCREEN | Window flag: Hide all screen decorations (e.g. 让window进行全屏显示 |
int | FLAG_HARDWARE_ACCELERATED | Indicates whether this window should be hardware accelerated. 对该window进行硬件加速. 该flag必须在设置你的Activity或Dialog的Content View之前进行设置, 而且如果你在mainfest文件中用Android:hardwareAccelerated开启了该属性的话,那么你在程序中就不能再改变它。mainfest文件中android:hardwareAccelerated属性默认是开启的("true")。 |
int | FLAG_IGNORE_CHEEK_PRESSES | Window flag: intended for windows that will often be used when the user is holding the screen against their face, it will aggressively filter the event stream to prevent unintended presses in this situation that may not be desired for a particular window, when such an event stream is detected, the application will receive a CANCEL motion event to indicate this so applications can handle this accordingly by taking no action on the event until the finger is released. |
int | FLAG_KEEP_SCREEN_ON | Window flag: as long as this window is visible to the user, keep the device's screen turned on and bright. 当该window对用户可见时,让设备屏幕处于高亮(bright)状态。 |
int | FLAG_LAYOUT_INSET_DECOR | Window flag: a special option only for use in combination with FLAG_LAYOUT_IN_SCREEN . |
int | FLAG_LAYOUT_IN_SCREEN | Window flag: place the window within the entire screen, ignoring decorations around the border (a.k.a. 让window占满整个手机屏幕,不留任何边界(border) |