Я использую Libgdx для своего приложения Android. Недавно я добавил код, включающий window и rootview, теперь он показывает ошибку:
"I/AndroidApplication: Content already displayed, cannot request FEATURE_NO_TITLE
android.util.AndroidRuntimeException: requestFeature() must be called before adding content"
Я добавил requestWindowFeature (Window.FEATURE_NO_TITLE) или window.requestFeature (Window.FEATURE_NO_TITLE) перед super.onCreate () в onCreate ( ), но ошибка по-прежнему сохраняется.
Вот как выглядит мой метод onCreate внутри AndroidLauncher:
override fun onCreate(savedInstanceState: Bundle?) {
//todo
requestWindowFeature(Window.FEATURE_NO_TITLE)
super.onCreate(savedInstanceState)
val config = AndroidApplicationConfiguration()
rootView = window.decorView.rootView
val rect = Rect()
rootView.getWindowVisibleDisplayFrame(rect)
width = rect.width()
height = rect.height()
androidView = AndroidView(width, height)
rootView.addOnLayoutChangeListener { v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom ->
val localRect = Rect()
rootView.getWindowVisibleDisplayFrame(localRect)
if (!(width == localRect.width() && height == localRect.height())) {
width = localRect.width()
height = localRect.height()
androidView.onSizeChange(width.toFloat(), height.toFloat())
}
}
main = Main(this, ApplicationBundle(androidView))
initialize(main, config)
}
Как я могу его решить?