本文整理汇总了Java中android.view.View.SYSTEM_UI_FLAG_HIDE_NAVIGATION属性的典型用法代码示例。如果您正苦于以下问题:Java View.SYSTEM_UI_FLAG_HIDE_NAVIGATION属性的具体用法?Java View.SYSTEM_UI_FLAG_HIDE_NAVIGATION怎么用?Java View.SYSTEM_UI_FLAG_HIDE_NAVIGATION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.view.View
的用法示例。
在下文中一共展示了View.SYSTEM_UI_FLAG_HIDE_NAVIGATION属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
@Override
protected void onCreate(Bundle savedInstanceState) {
ActivityCompat.setExitSharedElementCallback(this, exitTransitionCallback);
super.onCreate(savedInstanceState);
int mUIFlag = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
getWindow().getDecorView().setSystemUiVisibility(mUIFlag);
setContentView(R.layout.activity_gallery);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
ArrayList<String> imagesList = new ArrayList<>();
for (int i = 1; i <= 23; i++)
imagesList.add("http://ssninstincts.org.in/img/gallery/big/" + i + ".jpg");
galleryAdapter = new GalleryAdapter(this, imagesList);
StaggeredGridLayoutManager gridLayoutManager =
new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
gridLayoutManager.setGapStrategy(StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS);
galleryRecyclerView.setHasFixedSize(true);
galleryRecyclerView.setLayoutManager(gridLayoutManager);
galleryRecyclerView.setAdapter(galleryAdapter);
}
示例2: onWindowFocusChanged
/**
* Called when view focus is changed
*/
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus && immersiveMode) {
final 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
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
getWindow().getDecorView().setSystemUiVisibility(uiOptions);
}
}
示例3: initSystemBar
/**
* 修复popup显示时退出沉浸的问题
*
* @param view
*/
void initSystemBar(View view) {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_FULLSCREEN;
boolean isFullScreen = view.getSystemUiVisibility() == uiOptions;
if (isFullScreen) {
hideSystemUI(view);
} else {
//showSystemUI(view);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例4: 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;
}
示例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: FullScreencall
public void FullScreencall() {
if (Build.VERSION.SDK_INT > 11 && Build.VERSION.SDK_INT < 19) { // lower api
View v = this.getWindow().getDecorView();
v.setSystemUiVisibility(View.GONE);
} else if (Build.VERSION.SDK_INT >= 19) {
//for new api versions.
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
decorView.setSystemUiVisibility(uiOptions);
}
}
示例7: toggleSystemUiVisibility
private static void toggleSystemUiVisibility(Window activityWindow) {
int newUiOptions = activityWindow.getDecorView().getSystemUiVisibility();
newUiOptions ^= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
newUiOptions ^= View.SYSTEM_UI_FLAG_FULLSCREEN;
newUiOptions ^= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
activityWindow.getDecorView().setSystemUiVisibility(newUiOptions);
}
示例8: 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);
}
示例9: getSystemUiVisibility
@TargetApi(19)
private static int getSystemUiVisibility() {
int flags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
flags |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
}
return flags;
}
示例10: showNavigationBar
public static void showNavigationBar(Window window) {
if (window == null) {
return;
}
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
window.addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
final View decorView = window.getDecorView();
if (decorView != null) {
int uiOptions = decorView.getSystemUiVisibility();
if (Build.VERSION.SDK_INT >= 14) {
uiOptions &= ~View.SYSTEM_UI_FLAG_LOW_PROFILE;
}
if (Build.VERSION.SDK_INT >= 16) {
uiOptions &= ~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
}
if (Build.VERSION.SDK_INT >= 19) {
uiOptions &= ~View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
}
decorView.setSystemUiVisibility(uiOptions);
}
}
示例11: getExtraFullscreenUIFlags
private static int getExtraFullscreenUIFlags() {
int flags = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
flags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
flags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
flags |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
}
return flags;
}
示例12: updateSystemUiVisibilityFlagsForExpandedDesktop
private static int updateSystemUiVisibilityFlagsForExpandedDesktop(int vis) {
if (isNavbarImmersive()) {
vis |= ViewConst.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
}
if (isStatusbarImmersive()) {
vis |= ViewConst.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_FULLSCREEN;
}
return vis;
}
示例13: hideNavigationBar
/**
* <pre>{@code
* @Override
* public void onWindowFocusChanged(boolean hasFocus) {
* super.onWindowFocusChanged(hasFocus);
* if (hasFocus) {
* // place here
* }
* }
* }</pre>
*/
public static void hideNavigationBar(Window window) {
if (window == null) {
return;
}
window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
final View decorView = window.getDecorView();
if (decorView != null) {
int uiOptions = decorView.getSystemUiVisibility();
if (Build.VERSION.SDK_INT >= 14) {
uiOptions |= View.SYSTEM_UI_FLAG_LOW_PROFILE;
}
if (Build.VERSION.SDK_INT >= 16) {
uiOptions |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
}
if (Build.VERSION.SDK_INT >= 19) {
uiOptions |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
}
decorView.setSystemUiVisibility(uiOptions);
}
}
示例14: onCreate
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityCompat.postponeEnterTransition(this);
ActivityCompat.setEnterSharedElementCallback(this, enterTransitionCallback);
int mUIFlag = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
getWindow().getDecorView().setSystemUiVisibility(mUIFlag);
setContentView(R.layout.activity_view_pager_gallery);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle("Gallery");
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
galleryViewPagerAdapter = new GalleryViewPagerAdapter(this);
viewPager = (ViewPager) findViewById(R.id.container);
viewPager.setAdapter(galleryViewPagerAdapter);
int position = selectedIndex = getIntent().getIntExtra(EXTRA_POSITION, 0);
viewPager.setCurrentItem(position);
viewPager.setOnPageChangeListener(pageChangeListener);
viewPager.getViewTreeObserver().addOnGlobalLayoutListener(pagerLayoutListener);
}
示例15: toggleFullscreenMode
public void toggleFullscreenMode(boolean isFullscreen) {
View decorView = getWindow().getDecorView();
if (isFullscreen) {
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
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
decorView.setSystemUiVisibility(uiOptions);
}
}