안드로이드는 태블릿인지 폰인지 판단을 screen size type으로 구분한다.
fun isTablet(): Boolean {
val screenSizeType = resources.configuration.screenLayout and Configuration.SCREENLAYOUT_SIZE_MASK
if (screenSizeType == Configuration.SCREENLAYOUT_SIZE_XLARGE ||
screenSizeType == Configuration.SCREENLAYOUT_SIZE_LARGE) {
return true
}
return false
}
'프로그래밍 > android' 카테고리의 다른 글
[android] apk decompile (안드로이드 apk 디컴파일) (0) | 2021.11.30 |
---|---|
[Android 12] Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE (0) | 2021.11.18 |
[android] Kotlin ArrayList SharedPreferences json data (feat. Gson) (0) | 2021.08.24 |
Android 11 Full Screen (0) | 2021.07.29 |
[android] Dp to Px, Px to Dp (0) | 2021.06.30 |