如何在横向模式下显示android启动屏幕?
我正在开发一款android应用程序,希望在系统加载应用程序时以横向模式显示启动屏幕 我制作了一个小测试应用程序来重现这个问题,发现它实际上是在纵向模式下工作的,但是当我将这一行添加到我的清单中时,它突然不再工作了。它不会显示任何初始屏幕,就好像属性如何在横向模式下显示android启动屏幕?,android,performance,android-layout,splash-screen,Android,Performance,Android Layout,Splash Screen,我正在开发一款android应用程序,希望在系统加载应用程序时以横向模式显示启动屏幕 我制作了一个小测试应用程序来重现这个问题,发现它实际上是在纵向模式下工作的,但是当我将这一行添加到我的清单中时,它突然不再工作了。它不会显示任何初始屏幕,就好像属性windowPreviewDisabled设置为true一样。 有人知道我做错了什么吗 我的舱单: <activity android:name=".MainActivity" android:theme="@style/AppTheme.La
windowPreviewDisabled
设置为true一样。
有人知道我做错了什么吗
我的舱单:
<activity android:name=".MainActivity" android:theme="@style/AppTheme.Launcher" android:screenOrientation="sensorLandscape" android:launchMode="singleTask" android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.
</intent-filter>
</activity>
也许您可以添加
setRequestedOrientation(ActivityInfo.SCREEN\u ORIENTATION\u SENSOR\u横向)代码>
在setContentView方法之后的活动中。这就是我现在要做的。我基本上是从纵向模式开始,然后在onCreate
中切换到横向模式。但仍然不确定为什么它不能在横向模式下工作。奇怪的是,它不能工作。您是否尝试以编程方式设置布局?类似于这样:if(newConfig.orientation==Configuration.orientation_-scape){createHorizontalalLayout();}否则if(newConfig.orientation==Configuration.orientation_-rait){createVerticalLayout();}
<style name="AppTheme.Launcher" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowBackground">@layout/launch_screen</item>
</style>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
<item android:drawable="@android:color/black"/>
<item>
<bitmap
android:src="@drawable/logo2"
android:gravity="center"/>
</item>
</layer-list>