[Points] Immersive Mode

Using Immersive Full-Screen Mode

  • android 4.4(Api level 19) introduce
  • view.setSystemUiVisibility() SYSTEM_UI_FLAG_IMMERSIVE combine with SYSTEM_UI_FLAG_HIDE_NAVIGATION and SYSTEM_UI_FLAG_FULLSCREEN
  • reveal the system bars with an inward swipe along the region where the system bars normally appear(clean hide_navigation and full_screen flag)
  • system bars auto hide after a few moments, use SYSTEM_UI_FLAG_IMMERSIVE_STICKY

   

Immersive mode states:

  • Non-immersive mode the user swipes to display the system bars,clearing the SYSTEM_UI_FLAG_HIDE_NAVIGATION and SYSTEM_UI_FLAG_FULLSCREEN flags.View.OnSystemUiVisibilityChangeListener() to watch for ui changes
  • Reminder bubble guide for first time users enter immersive mode in your app
  • Immersive mode system bars hidden
  • Sticky flag use IMMERSIVE_STICKY flag and Semi-transparent bars temporarily appear and then hide again. The act of swiping doesn't clear any flags.

Note immersive mode take effect if you use immersive flag conjunction with SYSTEM_UI_FLAG_HIDE_NAVIGATION,SYSTEM_UI_FLAG_FULLSCREEN or both

Choose an Approach

  • building a book reader,news reader or a magazine,use the IMMERSIVE flag is good option.Because users may want to access the action bar and other UI controls somewhat frequently
  • expect users to interact near the edges of the sceen and you don't expect them to need frequent access to the system ui use the IMMERSIVE_STICKY flag
  • lean back style touch anywhere back tools.

Use Non-Sticky Immersion

  • include other system Ui flags(such as SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION and SYSTEM_UI_FLAG_LAYOUT_STABLE) to keep the content from resizing when the system bars hide and show.
  • register a listener described in Responding to UI Visibility Changes
  • Implement onWindowFocusChanged().If you lose window focus, for example due to a dialog or pop up menu showing above your app, you'll probably want to cancel any pending "hide" operations you previously scheduled with Handler.postDelayed() or something similar.
  • Implement a GestureDetector that detects onSingleTapUp(MotionEvent), to allow users to manually toggle the visibility of the system bars by touching your content.

Use Sticky Immersion

  • an inward swipe in the system bars areas causes the bars to temporarily appear in a semi-transparent state but ni flags are cleared
  • If you like the auto-hiding behavior of IMMERSIVE_STICKY but need to show your own UI controls as well, just use IMMERSIVE combined with Handler.postDelayed() or something similar to re-enter immersive mode after a few seconds.

NOTE watch the video DevBytes: Android 4.4 Immersive Mode]

posted @ 2013-12-05 22:07  Jsaint  阅读(521)  评论(0)    收藏  举报