Actiivty 横屏设置, 为什么会先显示一会竖屏?
var TAG = "Test"
override fun onCreate(savedInstanceState: Bundle?) {
setOrientation()
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
Log.d(TAG, "onCreate")
}
private fun setOrientation() {
//隐藏标题
requestWindowFeature(Window.FEATURE_NO_TITLE);
//设置全屏
window.setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN
)
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
}
为什么会先出来一会的竖屏, 才会横屏显示 ?
但是在 AndroidManifest.xml 中设置
```
android:configChanges="orientation|keyboardHidden|navigation"
android:screenOrientation="landscape"/>
就能正常横屏显示....