android-displaycutout

Incorrect displayCutout in landscape orientation when you hold your device at some angle

耗尽温柔 提交于 2021-02-05 11:23:11
问题 So we can get for example safe inset top value (useful for devices which have notch/cutout): override fun onAttachedToWindow() { super.onAttachedToWindow() if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { val safeInsetTop = window.decorView.rootWindowInsets?.displayCutout?.safeInsetTop if (DEBUG) Timber.d("onAttachedToWindow, safeInsetTop: $safeInsetTop") } } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) if (DEBUG) Timber.d("onCreate") if