小编kim*_*oty的帖子

Prevent fullscreen exit (window flag clear?) on orientation change

I have a fullscreen activity, with no configChanges set in AndroidManifest.xml so that the system recreates the activity on orientation change. Everything works fine here, except that intermittently, an orientation change seems to cause the app to exit fullscreen mode and bring the system ui back in.

我有代码可以在发生这种情况时重新进入全屏模式,但我想防止它从全屏模式开始。我想知道为什么会发生这种情况?

我还观察到,这只发生debuggable在 build.gradle 中为构建配置(发布或调试)的标志设置为 false 时

活动.kt

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    // initial fullscreen mode before content loads
    enterFullscreenMode()

    window.decorView.setOnSystemUiVisibilityChangeListener { visibility ->
        if (visibility and View.SYSTEM_UI_FLAG_FULLSCREEN == 0) …
Run Code Online (Sandbox Code Playgroud)

android screen-orientation kotlin

5
推荐指数
1
解决办法
95
查看次数

标签 统计

android ×1

kotlin ×1

screen-orientation ×1