2019. 11. 11. 11:23ㆍ모바일/Android_Java
WindowManager를 사용하면, Activity의 제약사항을 뛰어넘어서 개발할 수 있다.
- Context별 사용법을 정확히 알아야한다.
- 메모리 관리를 잘 해야 한다.
- 잠금 해제는 Activity Context 만 가능하다.
팝업창 구현이 쉽지 않다. 최상위 팝업 구현을 하려고 하는데 전화가 걸려오면 최상위로 팝업되는 경우도 있고 뒤로 숨는 경우도 있다.
그래서 블로드, 사이트 등에서 기능을 찾아 정리해보고 있지만, 완벽한 해결이 되지 못했다.
(https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html)
FLAG_DISMISS_KEYGUARD
window가 attach되면 잠금해제를 하는 flag.
Activity Context를 가진 윈도우매니저에서만 동작FLAG_LAYOUT_NO_LIMITS
allow window to extend outside of the screen.
window가 화면을 벗어나서도 배치될 수 있다.
숨기거나 일부만 보이는 윈도우를 만들때 사용FLAG_LAYOUT_IN_SCREEN
place the window within the entire screen, ignoring decorations around the border (such as the status bar).
window가 보여지는 화면의 전체 영역을 가진다.
status bar 혹은 navigation bar 영역까지도 배치될 수 있다.- 개발 중 팝업화면 뒤 회색화면이 상태바 까지 덮는현상이 있었음.. 이 플래그 삭제시켜주니 정상적으로 작동했다!
FLAG_NOT_FOCUSABLE
this window won't ever get key input focus, so the user can not send key or other button events to it.
해당 윈도우가 input focus를 받지 않게 된다.
즉 home button 이나 back button처럼 focus를 받아야 동작하는 것들을 다음 우선순위 window에 넘긴다.FLAG_NOT_TOUCH_MODAL
even when this window is focusable (its FLAG_NOT_FOCUSABLE is not set), allow any pointer events outside of the window to be sent to the windows behind it.
해당 윈도우가 터치를 받지 않게 된다.
터치가 오면 다음 우선순위 window에 넘긴다.
FLAG_KEEP_SCREEN_ON
as long as this window is visible to the user, keep the device's screen turned on and bright.FLAG_WATCH_OUTSIDE_TOUCH
if you have set FLAG_NOT_TOUCH_MODAL, you can set this flag to receive a single special MotionEvent with the action MotionEvent.ACTION_OUTSIDE for touches that occur outside of your window.FLAG_SHOW_WHEN_LOCKED
This constant was deprecated in API level 27. Use showWhenLocked or setShowWhenLocked(boolean) instead to prevent an unintentional double life-cycle event.FLAG_TURN_SCREEN_ON
This constant was deprecated in API level 27. Use turnScreenOn or setTurnScreenOn(boolean) instead to prevent an unintentional double life-cycle event.
'모바일 > Android_Java' 카테고리의 다른 글
시간구하기 (0) | 2019.12.12 |
---|---|
postDelayed (0) | 2019.12.05 |
adapter에서 activity에 접근하기 (0) | 2019.11.08 |
Static (0) | 2019.10.30 |
테마관련 (0) | 2019.10.28 |