getWindow.setFlags()
接着整理webview 中播放视频所用到的一些参数。
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
这段代码会让整个窗体全屏。
getWindow() 是Activity 中的一个方法,获取当前的window,setFlags()是android.view.window 中的方法详细参数:andorid developer
void setFlags (int flags, int mask)
Set the flags of the window, as per the WindowManager.LayoutParams flags.
设置参数 windowManager.LayoutParams
Note that some flags must be set before the window decoration is created (by the first call to setContentView(View, android.view.ViewGroup.LayoutParams) or getDecorView(): FLAG_LAYOUT_IN_SCREEN and FLAG_LAYOUT_INSET_DECOR. These will be set for you based on the windowIsFloating attribute.
有一些参数必须在window创建之前申请。这个就不用管他了,直接在onCreate的时候首先设置这个参数就可以了。
Parameters
flags int: The new window flags (see WindowManager.LayoutParams).
mask int: Which of the window flag bits to modify.
要什么效果直接去 windowManager.LayoutParams中去查就行了。
列举几个常用的:
FLAG_FULLSCREEN 全屏
Window flag: hide all screen decorations (such as the status bar) while this window is displayed.
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.
FLAG_BLUR_BEHIND 背景模糊
This constant was deprecated in API level 14. Blurring is no longer supported.
关注微信公众号,每天都有优质技术文章,搞笑GIF图片推送哦。