本文整理汇总了Java中android.view.View.SYSTEM_UI_FLAG_VISIBLE属性的典型用法代码示例。如果您正苦于以下问题:Java View.SYSTEM_UI_FLAG_VISIBLE属性的具体用法?Java View.SYSTEM_UI_FLAG_VISIBLE怎么用?Java View.SYSTEM_UI_FLAG_VISIBLE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.view.View
的用法示例。
在下文中一共展示了View.SYSTEM_UI_FLAG_VISIBLE属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setStatusBarColor
/**
* set StatusBarColor
* <p>
* 1. set Flags to call setStatusBarColor
* 2. call setSystemUiVisibility to clear translucentStatusBar's Flag.
* 3. set FitsSystemWindows to false
*/
static void setStatusBarColor(Activity activity, int statusColor, boolean isLight) {
Window window = activity.getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(statusColor);
int options = View.SYSTEM_UI_FLAG_VISIBLE;
if (isLight) {
options = options | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
}
window.getDecorView().setSystemUiVisibility(options);
ViewGroup contentview = (ViewGroup) window.findViewById(Window.ID_ANDROID_CONTENT);
View childview = contentview.getChildAt(0);
if (childview != null) {
childview.setFitsSystemWindows(false);
childview.requestApplyInsets();
}
}
示例2: SystemUiHiderHoneycomb
/**
* Constructor not intended to be called by clients. Use
* {@link SystemUiHider#getInstance} to obtain an instance.
*/
protected SystemUiHiderHoneycomb(Activity activity, View anchorView, int flags) {
super(activity, anchorView, flags);
mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
if ((mFlags & FLAG_FULLSCREEN) != 0) {
// If the client requested fullscreen, add flags relevant to hiding
// the status bar. Note that some of these constants are new as of
// API 16 (Jelly Bean). It is safe to use them, as they are inlined
// at compile-time and do nothing on pre-Jelly Bean devices.
mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_FULLSCREEN;
}
if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
// If the client requested hiding navigation, add relevant flags.
mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
mTestFlags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
}
}
示例3: hideBar
/**
* Hide bar.
* 隐藏或显示状态栏和导航栏。 状态栏和导航栏的颜色不起作用,都是透明色,以最后一次调用为准
*
* @param uiFlags the ui flags
* @return the int
*/
private int hideBar(int uiFlags) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
switch (mBarParams.barHide) {
case FLAG_HIDE_BAR:
uiFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.INVISIBLE;
break;
case FLAG_HIDE_STATUS_BAR:
uiFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.INVISIBLE;
break;
case FLAG_HIDE_NAVIGATION_BAR:
uiFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
break;
case FLAG_SHOW_BAR:
uiFlags |= View.SYSTEM_UI_FLAG_VISIBLE;
break;
}
}
return uiFlags | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
}
示例4: SystemUiHiderHoneycomb
/**
* Constructor not intended to be called by clients. Use
* {@link SystemUiHider#getInstance} to obtain an instance.
*/
protected SystemUiHiderHoneycomb(Activity activity, View anchorView, int flags) {
super(activity, anchorView, flags);
mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
if ((mFlags & FLAG_FULLSCREEN) != 0) {
// If the client requested fullscreen, add flags relevant to hiding
// the status bar. Note that some of these constants are new as of
// API 16 (Jelly Bean). It is safe to use them, as they are inlined
// at compile-time and do nothing on pre-Jelly Bean devices.
mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_FULLSCREEN;
}
if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
// If the client requested hiding navigation, add relevant flags.
mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
mTestFlags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
}
}
示例5: SystemUiHiderHoneycomb
/**
* Constructor not intended to be called by clients. Use {@link SystemUiHider#getInstance} to
* obtain an instance.
*/
protected SystemUiHiderHoneycomb(Activity activity, View anchorView, int flags) {
super(activity, anchorView, flags);
mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
if ((mFlags & FLAG_FULLSCREEN) != 0) {
// If the client requested fullscreen, add flags relevant to hiding
// the status bar. Note that some of these constants are new as of
// API 16 (Jelly Bean). It is safe to use them, as they are inlined
// at compile-time and do nothing on pre-Jelly Bean devices.
mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_FULLSCREEN;
}
if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
// If the client requested hiding navigation, add relevant flags.
mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
mTestFlags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
}
}
示例6: SystemUiHiderHoneycomb
/**
* Constructor not intended to be called by clients. Use {@link SystemUiHider#getInstance} to
* obtain an instance.
*/
protected SystemUiHiderHoneycomb(Activity activity, View anchorView, int flags) {
super(activity, anchorView, flags);
mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
if ((mFlags & FLAG_FULLSCREEN) != 0) {
// If the client requested fullscreen, add flags relevant to hiding
// the status bar. Note that some of these constants are new as of
// API 16 (Jelly Bean). It is safe to use them, as they are inlined
// at compile-time and do nothing on pre-Jelly Bean devices.
mShowFlags |= 0x00000400;// View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
mHideFlags |= 0x00000400 //View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| 0x00000004; // View.SYSTEM_UI_FLAG_FULLSCREEN;
}
if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
// If the client requested hiding navigation, add relevant flags.
mShowFlags |= 0x00000200;//View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
mHideFlags |= 0x00000200//View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| 0x00000002;//View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
mTestFlags |= 0x00000002;//View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
}
}
示例7: _expand
private void _expand() {
View decorView = getWindow().getDecorView();
if (decorView != null) {
boolean isNotFullScreen = decorView.getSystemUiVisibility() == View.SYSTEM_UI_FLAG_VISIBLE;
if (isNotFullScreen) {
goFullscreen();
} else {
exitFullscreen();
}
}
}
示例8: onPause
@Override
protected void onPause() {
mSounds.releaseBGM();
pause();
int uiOptions = View.SYSTEM_UI_FLAG_VISIBLE;
getWindow().getDecorView().setSystemUiVisibility(uiOptions);
mSounds.releaseBGM();
super.onPause();
}
示例9: showSystemBar
protected void showSystemBar(boolean show) {
if (mSystemBarShowing == show) return;
mSystemUiVisibility = mPlayerView.getSystemUiVisibility();
if (PlayerConfig.hasHackedFullScreen()) {
final int STATUS_BAR_GONE = (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1 ? 0x00000004 : 0x000008);
if (show)
mSystemUiVisibility &= ~STATUS_BAR_GONE;
else
mSystemUiVisibility |= STATUS_BAR_GONE;
manualVisibilityChange=true;
mPlayerView.setSystemUiVisibility(mSystemUiVisibility);
mSystemBarGone = !show;
} else {
int systemUiFlag = View.SYSTEM_UI_FLAG_LOW_PROFILE;
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { /* ICS and less */
if (show)
mWindow.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
else
mWindow.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else { /* JB and more */
systemUiFlag |= 0x00000004 /* View.SYSTEM_UI_FLAG_FULLSCREEN */;
}
if (show) {
mSystemUiVisibility &= ~systemUiFlag;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
mSystemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE;
}
else {
mSystemUiVisibility |= systemUiFlag;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
mSystemUiVisibility |= View.SYSTEM_UI_FLAG_IMMERSIVE;
}
mPlayerView.setSystemUiVisibility(mSystemUiVisibility);
manualVisibilityChange=true;
mSystemBarGone = false;
if (PlayerConfig.canSystemBarHide()) {
if (!show)
mHandler.sendEmptyMessageDelayed(MSG_HIDE_SYSTEM_BAR, 1000);
}
}
mSystemBarShowing = show;
}
示例10: createShowFlags
@Override
protected int createShowFlags() {
return View.SYSTEM_UI_FLAG_VISIBLE;
}