SlideShare a Scribd company logo
1 of 97
Download to read offline
안드로이드 윈도우
마스터되기
Speaker.안명욱
Window 란?
Window Fitting의 필요성
버전별 윈도우 프레임워크
Window Fitting 방식
fitSystemWindows 방식
Manual Handling 방식
잘못 사용한 방식들
WindowInsets 사용하기
Display Cutout
목차
Window 란?
Window란?

Window Fit의 필요성

버전별 윈도우 프레임워크

Window Fit 방식

fitSystemWindows 방식 

Manual Handling 방식

잘못 사용한 방식들

WindowInsets 사용하기

Display Cutout
Window
모든 UI는 윈도우 안에 있음
Key Handling
Window Decor
Activity는 Window를 내부적으로 가짐
Activity#getWindow()
Window
Dialog도 Window를 가짐
Dialog#getWindow()
Window
Window Fitting의 필요성
Window란?

Window Fit의 필요성

버전별 윈도우 프레임워크

Window Fit 방식

fitSystemWindows 방식 

Manual Handling 방식

잘못 사용한 방식들

WindowInsets 사용하기

Display Cutout
우리가 원하는 레이아웃을 구성하기 위하여,
윈도우와 우리 뷰를 적절히 설정하기
Window Fitting
창틀에 유리 끼우기
버전별 Window의 변
화 Window란?

Window Fit의 필요성

버전별 윈도우 프레임워크

Window Fit 방식

fitSystemWindows 방식 

Manual Handling 방식

잘못 사용한 방식들

WindowInsets 사용하기

Display Cutout
Jelly Bean과 그 이전 세대
Window는 시스템바들 사이에 위치
Jelly Bean과 그 이전 세대
setSystemUiVisiblity()
SYSTEM_UI_FLAG_LOW_PROFILE

SYSTEM_UI_FLAG_HIDE_NAVIGATION

SYSTEM_UI_FLAG_FULLSCREEN

SYSTEM_UI_FLAG_VISIBLE
SYSTEM_UI_FLAG_IMMERSIVE_STICKY

SYSTEM_UI_FLAG_IMMERSIVE
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR

SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
SYSTEM_UI_FLAG_LAYOUT_STABLE

SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION

SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
SYSTEM_UI_FLAG_LOW_PROFILE

SYSTEM_UI_FLAG_HIDE_NAVIGATION

SYSTEM_UI_FLAG_FULLSCREEN

SYSTEM_UI_FLAG_VISIBLE
SYSTEM_UI_FLAG_IMMERSIVE_STICKY

SYSTEM_UI_FLAG_IMMERSIVE
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR

SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
SYSTEM_UI_FLAG_LAYOUT_STABLE

SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION

SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
Window Transform Flags(윈도우 변환 플래그)
WTF
myView.systemUiVisiblity =
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
KitKat
KitKat
반투명 시스템 바
내부적으로 WTF가 사용됨
Lollipop
Lollipop
android:windowDrawsSystemBarBackgrounds

시스템바 백그라운드가
우리 윈도우 안에 위치 함
android:navigationBarColor
getWindow().setNavigationBarColor()
android:statusBarColor
getWindow().setStatusBarColor()
Lollipop
반투명 시스템 바
android:windowTranslucentStatus=“true”
android:windowTranslucentNavigation=“true”
어떤 커스텀 컬러보다 우선시 함
windowDrawsSystemBarBackgrounds

를 비활성하게 됨
Window Fit 방식
: fitSystemWindowsWindow란?

Window Fit의 필요성

버전별 윈도우 프레임워크

Window Fit 방식

fitSystemWindows 방식 

Manual Handling 방식

잘못 사용한 방식들

WindowInsets 사용하기

Display Cutout
android:fitSystemWindows=“true"
View.java의 기본동작:
Padding을 추가하여 Insets 안으로
Child View들를 이동시킨다.
android:fitSystemWindows=“true"
systemUiVisibility =
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
android:fitSystemWindows=“true"
Padding
Padding
systemUiVisibility =
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
android:fitSystemWindows=“true"
android:fitSystemWindows=“true"
systemUiVisibility =
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
android:fitSystemWindows=“true"
DrawerLayout
CoordinatorLayout
AppBarLayout
CollapsingToolbarLayout
View는 Padding을 추가하여 Child View를
Inset 안으로 이동시킨다.
몇몇 View Class에서는 다르게 동작한다.
DrawerLayout
API 21+에서는 WTF를 설정해줌
android:fitSystemWindows=“true"
DrawerLayout
fitSystemWindows를
자식뷰들로부터의 신호로 사용
API 21+에서는 WTF를 설정해줌
android:fitSystemWindows=“true"
android:fitSystemWindows=“true"
DrawerLayout
CoordinatorLayout
AppBarLayout
CollapsingToolbarLayout
일반적으로는 View에 Padding을 추가하여 Child View를
Inset 안으로 이동시켜, 시스템UI와 겹치지 않도록 해준다.
몇몇 View Class에서는 fitSystemWindows를 오버라이
드 하여 다른 동작을 한다.
WTF를 자동으로 설정하여,시스템
UI 뒷편으로 Draw가 가능하게 해준
다.
자식뷰에서는 부모뷰따라 확장하기 위
한 신호로 사용된다.
Window Fit 방식
: Manual HandlingWindow란?

Window Fit의 필요성

버전별 윈도우 프레임워크

Window Fit 방식

fitSystemWindows 방식 

Manual Handling 방식

잘못 사용한 방식들

WindowInsets 사용하기

Display Cutout
Window Manual Fit
: 잘못 사용한 방식들Window란?

Window Fit의 필요성

버전별 윈도우 프레임워크

Window Fit 방식

fitSystemWindows 방식 

Manual Handling 방식

잘못 사용한 방식들

WindowInsets 사용하기

Display Cutout
Status bar의 높이값을 임의로 지정하기
Status bar의 사이드가 변경된다면?
Status bar 사이즈가 다른 디바이스에서
는?
24dp
48dp
Internal system resource 값에서 가져
오기
frameworks/base/core/res/values/dimens.xml
Internal resource의 이름이 변경된다
면?
Status bar뒷편의 draw를
막는 디바이스가 있다면?
Window Manual Fit
: WindowInsets을 사용하자Window란?

Window Fit의 필요성

버전별 윈도우 프레임워크

Window Fit 방식

fitSystemWindows 방식 

Manual Handling 방식

잘못 사용한 방식들

WindowInsets 사용하기

Display Cutout
안드로이드 시스템에서
시스템 UI가 어디에 위치해있는지,
혹은 나중에 보여지게 될지를 안내해주는 역
할
WindowInsets
getSystemWindowInsetLeft()
getSystemWindowInsetTop()
getSystemWindowInsetRight()
getSystemWindowInsetBottom()
getDisplayCutout()
WindowInsetsCompat
getSystemWindowInsetLeft()
getSystemWindowInsetTop()
getSystemWindowInsetRight()
getSystemWindowInsetBottom()
0
74
0
126
Left()
Top()
Right()
Bottom()
0
74
126
0
WindowInsets은 완전히
소비(Consume) 될때까지 전달
된다.
Window Decor
LinearLayout
Child Child
dispatchApplyWindowInsets()
Window Decor
LinearLayout
Child Child
dispatchApplyWindowInsets()
0
63
0
126
Left :
Top :
Right :
Bottom :
onApplyWindowInsets()
LinearLayout
Window Decor
Child Child
0
0
0
126
Left :
Top :
Right :
Bottom :
onApplyWindowInsets()
consumeSystemWindowInsets

(left, top, right, bottom)
WindowInsets.isConsumed()
false
0
63
0
126
LinearLayout
Child
Window Decor
Child
0
0
0
126
Left :
Top :
Right :
Bottom :
dispatchApplyWindowInsets()
onApplyWindowInsets()
WindowInsets.isConsumed()
false
Child
Window Decor
0
0
0
Left :
Top :
Right :
Bottom :
dispatchApplyWindowInsets()
onApplyWindowInsets()
WindowInsets.isConsumed()
true
1260
Child
LinearLayout
consumeSystemWindowInsets

(left, top, right, bottom)
Display Cutout
Window란?

Window Fit의 필요성

버전별 윈도우 프레임워크

Window Fit 방식

fitSystemWindows 방식 

Manual Handling 방식

잘못 사용한 방식들

WindowInsets 사용하기

Display Cutout
android:windowLayoutInDisplayCutoutMode
never | default | shortEdges

window.attributes.layoutInDisplayCutoutMode =
LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER
LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
NEVER
윈도우는 DisplayCutout 영역에

절대로 오버래핑하지 못함
DEFAULT
윈도우가 DisplayCutout 영역까지 확장 허용
단, DisplayCutout이 System bar 영역에

완전히 포함되어 있는 경우에만
DEFAULT
윈도우가 DisplayCutout 영역까지 확장 허용
단, DisplayCutout이 System bar 영역에

완전히 포함되어 있는 경우에만
Landscape 모드에서는 letterbox 발생
SHORTEDGES
윈도우가 Cutout 영역으로 확장하는 것을

항상 허용
우리 앱의 Content의 중요한 부분이

Cutout 영역과 겹지 않도록 하는 것은

개발자의 몫
getSafeInsetLeft()
getSafeInsetTop()
getSafeInsetRight()
getSafeInsetBottom()
getBoundingRects()
DisplayCutout
getSafeInsetLeft()
getSafeInsetTop()
getSafeInsetRight()
getSafeInsetBottom()
getBoundingRects()
TOP
0
126
0
0
getSafeInsetLeft()
getSafeInsetTop()
getSafeInsetRight()
getSafeInsetBottom()
getBoundingRects()

RECT(414,0-666,126)
더블 디스플레이 

컷아웃
갤럭시S10

모서리 디스플레이 컷아웃
픽셀3
감사합니다.
chapi79@gmail.com
Reference
Chris Banes의 Becoming a master window fitter

https://chris.banes.me/talks/2017/becoming-a-master-window-fitter-nyc/

https://medium.com/androiddevelopers/windows-insets-fragment-
transitions-9024b239a436
WindowInsets

https://medium.com/@azizbekian/windowinsets-24e241d4afb9

https://developer.android.com/reference/android/view/WindowInsets

https://stackoverflow.com/questions/33585225/what-are-windowinsets
Display Cutout

https://developer.android.com/guide/topics/display-cutout

https://developer.android.com/reference/android/view/
WindowManager.LayoutParams

More Related Content

What's hot

Android Chromium Rendering Pipeline
Android Chromium Rendering PipelineAndroid Chromium Rendering Pipeline
Android Chromium Rendering PipelineHyungwook Lee
 
[2019] 딥러닝을 이용한 가상 피팅 룸
[2019] 딥러닝을 이용한 가상 피팅 룸[2019] 딥러닝을 이용한 가상 피팅 룸
[2019] 딥러닝을 이용한 가상 피팅 룸NHN FORWARD
 
Introduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCIntroduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCFunnelll
 
파이썬 생존 안내서 (자막)
파이썬 생존 안내서 (자막)파이썬 생존 안내서 (자막)
파이썬 생존 안내서 (자막)Heungsub Lee
 
[부스트캠프 웹・모바일 7기 Tech Talk]박명범_RecyclerView는 어떻게 재활용하는가
[부스트캠프 웹・모바일 7기 Tech Talk]박명범_RecyclerView는  어떻게  재활용하는가[부스트캠프 웹・모바일 7기 Tech Talk]박명범_RecyclerView는  어떻게  재활용하는가
[부스트캠프 웹・모바일 7기 Tech Talk]박명범_RecyclerView는 어떻게 재활용하는가CONNECT FOUNDATION
 
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...Simplilearn
 
메타버스 서비스에 Android 개발자가 할 일이 있나요?
메타버스 서비스에 Android 개발자가 할 일이 있나요?메타버스 서비스에 Android 개발자가 할 일이 있나요?
메타버스 서비스에 Android 개발자가 할 일이 있나요?Myungwook Ahn
 
[24]안드로이드 웹뷰의 모든것
[24]안드로이드 웹뷰의 모든것[24]안드로이드 웹뷰의 모든것
[24]안드로이드 웹뷰의 모든것NAVER Engineering
 
Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022Matt Raible
 
MVVM - Model View ViewModel
MVVM - Model View ViewModelMVVM - Model View ViewModel
MVVM - Model View ViewModelDareen Alhiyari
 
도메인 주도 설계의 본질
도메인 주도 설계의 본질도메인 주도 설계의 본질
도메인 주도 설계의 본질Young-Ho Cho
 
Declarative UIs with Jetpack Compose
Declarative UIs with Jetpack ComposeDeclarative UIs with Jetpack Compose
Declarative UIs with Jetpack ComposeRamon Ribeiro Rabello
 
[부스트캠퍼세미나]조성동_야_너두_TDD_할_수_있어
[부스트캠퍼세미나]조성동_야_너두_TDD_할_수_있어[부스트캠퍼세미나]조성동_야_너두_TDD_할_수_있어
[부스트캠퍼세미나]조성동_야_너두_TDD_할_수_있어CONNECT FOUNDATION
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework tola99
 
Robot framework 을 이용한 기능 테스트 자동화
Robot framework 을 이용한 기능 테스트 자동화Robot framework 을 이용한 기능 테스트 자동화
Robot framework 을 이용한 기능 테스트 자동화Jaehoon Oh
 
How native is React Native? | React Native vs Native App Development
How native is React Native? | React Native vs Native App DevelopmentHow native is React Native? | React Native vs Native App Development
How native is React Native? | React Native vs Native App DevelopmentDevathon
 

What's hot (20)

Android Chromium Rendering Pipeline
Android Chromium Rendering PipelineAndroid Chromium Rendering Pipeline
Android Chromium Rendering Pipeline
 
[2019] 딥러닝을 이용한 가상 피팅 룸
[2019] 딥러닝을 이용한 가상 피팅 룸[2019] 딥러닝을 이용한 가상 피팅 룸
[2019] 딥러닝을 이용한 가상 피팅 룸
 
Introduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCIntroduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoC
 
파이썬 생존 안내서 (자막)
파이썬 생존 안내서 (자막)파이썬 생존 안내서 (자막)
파이썬 생존 안내서 (자막)
 
[부스트캠프 웹・모바일 7기 Tech Talk]박명범_RecyclerView는 어떻게 재활용하는가
[부스트캠프 웹・모바일 7기 Tech Talk]박명범_RecyclerView는  어떻게  재활용하는가[부스트캠프 웹・모바일 7기 Tech Talk]박명범_RecyclerView는  어떻게  재활용하는가
[부스트캠프 웹・모바일 7기 Tech Talk]박명범_RecyclerView는 어떻게 재활용하는가
 
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
 
Vue.js
Vue.jsVue.js
Vue.js
 
메타버스 서비스에 Android 개발자가 할 일이 있나요?
메타버스 서비스에 Android 개발자가 할 일이 있나요?메타버스 서비스에 Android 개발자가 할 일이 있나요?
메타버스 서비스에 Android 개발자가 할 일이 있나요?
 
[24]안드로이드 웹뷰의 모든것
[24]안드로이드 웹뷰의 모든것[24]안드로이드 웹뷰의 모든것
[24]안드로이드 웹뷰의 모든것
 
Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022
 
MVVM - Model View ViewModel
MVVM - Model View ViewModelMVVM - Model View ViewModel
MVVM - Model View ViewModel
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
도메인 주도 설계의 본질
도메인 주도 설계의 본질도메인 주도 설계의 본질
도메인 주도 설계의 본질
 
Declarative UIs with Jetpack Compose
Declarative UIs with Jetpack ComposeDeclarative UIs with Jetpack Compose
Declarative UIs with Jetpack Compose
 
[부스트캠퍼세미나]조성동_야_너두_TDD_할_수_있어
[부스트캠퍼세미나]조성동_야_너두_TDD_할_수_있어[부스트캠퍼세미나]조성동_야_너두_TDD_할_수_있어
[부스트캠퍼세미나]조성동_야_너두_TDD_할_수_있어
 
ReactJS
ReactJSReactJS
ReactJS
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
 
Robot framework 을 이용한 기능 테스트 자동화
Robot framework 을 이용한 기능 테스트 자동화Robot framework 을 이용한 기능 테스트 자동화
Robot framework 을 이용한 기능 테스트 자동화
 
How native is React Native? | React Native vs Native App Development
How native is React Native? | React Native vs Native App DevelopmentHow native is React Native? | React Native vs Native App Development
How native is React Native? | React Native vs Native App Development
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 

Similar to 안드로이드 윈도우 마스터 되기

[안드앱콘] 1.다양한스크린사이즈
[안드앱콘] 1.다양한스크린사이즈[안드앱콘] 1.다양한스크린사이즈
[안드앱콘] 1.다양한스크린사이즈Neoroid
 
Touch Ux With Win32
Touch Ux With Win32Touch Ux With Win32
Touch Ux With Win32sung ki choi
 
webdynpro Wda Select Option Usage
webdynpro Wda Select Option Usagewebdynpro Wda Select Option Usage
webdynpro Wda Select Option Usagejung_se_hun
 
[NEXT] Android 개발 경험 프로젝트 1일차 (Widget, Linear Layout)
[NEXT] Android  개발 경험 프로젝트 1일차 (Widget, Linear Layout) [NEXT] Android  개발 경험 프로젝트 1일차 (Widget, Linear Layout)
[NEXT] Android 개발 경험 프로젝트 1일차 (Widget, Linear Layout) YoungSu Son
 
Windows Debugging Technique #3
Windows Debugging Technique #3Windows Debugging Technique #3
Windows Debugging Technique #3Wooseok Seo
 
다양한 모바일에서의 호환성 보장과 사이즈 지원 방법
다양한 모바일에서의 호환성 보장과 사이즈 지원 방법다양한 모바일에서의 호환성 보장과 사이즈 지원 방법
다양한 모바일에서의 호환성 보장과 사이즈 지원 방법mosaicnet
 
One click recovery_application-특허_및_제품_조사
One click recovery_application-특허_및_제품_조사One click recovery_application-특허_및_제품_조사
One click recovery_application-특허_및_제품_조사호상 장
 

Similar to 안드로이드 윈도우 마스터 되기 (7)

[안드앱콘] 1.다양한스크린사이즈
[안드앱콘] 1.다양한스크린사이즈[안드앱콘] 1.다양한스크린사이즈
[안드앱콘] 1.다양한스크린사이즈
 
Touch Ux With Win32
Touch Ux With Win32Touch Ux With Win32
Touch Ux With Win32
 
webdynpro Wda Select Option Usage
webdynpro Wda Select Option Usagewebdynpro Wda Select Option Usage
webdynpro Wda Select Option Usage
 
[NEXT] Android 개발 경험 프로젝트 1일차 (Widget, Linear Layout)
[NEXT] Android  개발 경험 프로젝트 1일차 (Widget, Linear Layout) [NEXT] Android  개발 경험 프로젝트 1일차 (Widget, Linear Layout)
[NEXT] Android 개발 경험 프로젝트 1일차 (Widget, Linear Layout)
 
Windows Debugging Technique #3
Windows Debugging Technique #3Windows Debugging Technique #3
Windows Debugging Technique #3
 
다양한 모바일에서의 호환성 보장과 사이즈 지원 방법
다양한 모바일에서의 호환성 보장과 사이즈 지원 방법다양한 모바일에서의 호환성 보장과 사이즈 지원 방법
다양한 모바일에서의 호환성 보장과 사이즈 지원 방법
 
One click recovery_application-특허_및_제품_조사
One click recovery_application-특허_및_제품_조사One click recovery_application-특허_및_제품_조사
One click recovery_application-특허_및_제품_조사
 

안드로이드 윈도우 마스터 되기