本文整理匯總了Java中android.view.View.SYSTEM_UI_FLAG_IMMERSIVE屬性的典型用法代碼示例。如果您正苦於以下問題:Java View.SYSTEM_UI_FLAG_IMMERSIVE屬性的具體用法?Java View.SYSTEM_UI_FLAG_IMMERSIVE怎麽用?Java View.SYSTEM_UI_FLAG_IMMERSIVE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.view.View
的用法示例。
在下文中一共展示了View.SYSTEM_UI_FLAG_IMMERSIVE屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: hideSystemUI
public static void hideSystemUI(@NonNull final Activity activity, final boolean immediate, final int delayMs) {
View decorView = activity.getWindow().getDecorView();
// Set the IMMERSIVE flag.
// Set the content to appear under the system bars so that the content
// doesn't resize when the system bars hide and show.
int uiState = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
| View.SYSTEM_UI_FLAG_FULLSCREEN; // hide status bar
if (Util.SDK_INT > 18) {
uiState |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_IMMERSIVE;
} else {
final Handler handler = new Handler();
decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int visibility) {
if (visibility == View.VISIBLE) {
Runnable runnable = new Runnable() {
@Override
public void run() {
hideSystemUI(activity, false);
}
};
if(immediate){
handler.post(runnable);
}else{
handler.postDelayed(runnable, delayMs);
}
}
}
});
}
decorView.setSystemUiVisibility(uiState);
}
示例2: toggleHideyBar
public static void toggleHideyBar(Activity activity, boolean onResume) {
int newUiOptions = activity.getWindow().getDecorView().getSystemUiVisibility();
if (onResume) {
applyImmersiveMode(activity);
} else {
newUiOptions ^= View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
newUiOptions ^= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
newUiOptions ^= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
newUiOptions ^= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
newUiOptions ^= View.SYSTEM_UI_FLAG_FULLSCREEN;
newUiOptions ^= View.SYSTEM_UI_FLAG_IMMERSIVE;
newUiOptions ^= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
activity.getWindow().getDecorView().setSystemUiVisibility(newUiOptions);
}
}
示例3: createHideFlags
@Override
protected int createHideFlags() {
int flag = super.createHideFlags();
if (mLevel == SystemUiHelper.LEVEL_IMMERSIVE) {
// If the client requested immersive mode, and we're on Android 4.4
// or later, add relevant flags. Applying HIDE_NAVIGATION without
// IMMERSIVE prevents the activity from accepting all touch events,
// so we only do this on Android 4.4 and later (where IMMERSIVE is
// present).
flag |= ((mFlags & SystemUiHelper.FLAG_IMMERSIVE_STICKY) != 0)
? View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
: View.SYSTEM_UI_FLAG_IMMERSIVE;
}
return flag;
}
示例4: setUiVisibilityKitKat
@TargetApi(Build.VERSION_CODES.KITKAT)
private void setUiVisibilityKitKat(boolean isVisible) {
int flags = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
if (!isVisible) {
flags |= View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE;
}
viewPager.setSystemUiVisibility(flags);
}
示例5: setFullScreen
private void setFullScreen() {
try {
if (Build.VERSION.SDK_INT < 19) {
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER,
WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER
);
} else {
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
| View.SYSTEM_UI_FLAG_IMMERSIVE;
decorView.setSystemUiVisibility(uiOptions);
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER,
WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER
);
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例6: 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;
}
示例7: onResume
@Override
protected void onResume() {
super.onResume();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY ;
getWindow().getDecorView().setSystemUiVisibility(uiOptions);
mSounds = App.getInstance(this).getSoundEffects();
unpause();
updateScores();
mSounds.playBGMusic();
}