0

为什么当我使用

setOnApplyWindowInsetsListener

状态栏颜色消失?

 fun isKeyboardVisible(view: View) {
    ViewCompat.setOnApplyWindowInsetsListener(view) { view, windowInsets ->
        val isKeyboardVisible = windowInsets.isVisible(WindowInsetsCompat.Type.ime())
        if (isKeyboardVisible) Toast.makeText(applicationContext, "opened", Toast.LENGTH_SHORT).show()
        else Toast.makeText(applicationContext, "closed", Toast.LENGTH_SHORT).show()

        windowInsets
    }
}
4

0 回答 0