기술(Tech, IT)/안드로이드(Android)

[Android] Immersive mode(이머시브 모드) - 전체 화면 모드 (1)

Daniel803 2021. 9. 16. 18:08

 안드로이드 전체 화면 모드는 Lean back, Immersive, Sticky immersive 3가지를 지원한다. 이 중 Immersive 모드에 대해 알아보겠다. Immersive 모드는 게임이나 갤러리에서 사진 보기, 책이나 발표 슬라이드 같은 페이지가 매겨진 내용물을 보는 것과 같은 사용자가 화면에 많은 몰두를 필요로 하는 상황을 위한 모드다. 

 Lean back 모드와의 차이점은 사용자가 상태표시줄이나 내비게이션 바 같은 시스템 바를 화면에 다시 가져오려면, 기기의 모서리를 훑도록 한 것이다. 화면 임의의 지점이 아닌 모소리를 훑은 의도적인 제스처로 시스템 바 복원을 하도록 한 것은, 사용자가 앱에 집중하는 것을 임의의 터치 등으로부터 방해받지 않도록 하기 윈한 것이다.

 Immersive 모드를 활성하 하기 위해선 setSystemUiVisibility() 메소드를 호출해 SYSTEM_UI_FLAG_IMMSERSIVE 플래그를 SYSTEM_UI_FLAG_FULLSCREEN 플래그와 SYSTEM_UI_FLAG_HIDE_NAVIGATION을 함께 넘겨주면 된다.

 

 isImmersive() 메소드를 호출해 액티비티가 현재 Immersive 모드인지("immersive") boolean 값으로 반환을 해준다. "immersive" 값은 manifest property에 android:immersive로 초기에 설정되기도 하는데 runtime에 setImmersive(boolean) 메소드를 통해 바뀔 수도 있다.

 

public boolean isImmersive ()

 

시스템 바 활성화를 위한 드래그 예시

 

 The immersive mode is intended for apps in which the user will be heavily interacting with the screen. Examples are games, viewing images in a gallery, or reading paginated content, like a book or slides in a presentation.

 When users need to bring back the system bars, they swipe from any edge where a system bar is hidden. By requiring this more deliberate gesture, the user's engagement with your app won't be interrupted by accidental touches and swipes.

 To enable immersive mode, call setSystemUiVisibility() and pass the SYSTEM_UI_FLAG_IMMERSIVE flag in conjunction with SYSTEM_UI_FLAG_FULLSCREEN and SYSTEM_UI_FLAG_HIDE_NAVIGATION.

 

 Bit indicating that this activity is "immersive" and should not be interrupted by notifications if possible. This value is initially set by the manifest property android:immersive but may be changed at runtime by setImmersive(boolean).

 

출처

 

- https://developer.android.com/training/system-ui/immersive

- https://developer.android.com/reference/android/app/Activity#isImmersive()