今天我开始尝试针对横向模式优化我的应用程序。但是我只是无法让我的应用程序在横向模式下运行,我没有启用强制纵向模式的设置。
我以占位符屏幕为例。
我还仔细检查了我的 AVD 中的自动旋转是否已启用。我在每个 AVD 上都有这个问题。
在我的清单中这样声明。
<activity
android:name=".PlaceholderActivity"
android:theme="@style/AppTheme.NoActionBar" />
我的布局看起来像这样。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_material_light"
android:orientation="vertical"
android:animateLayoutChanges="true" >
<View
android:id="@+id/icon"
android:layout_width="350dp"
android:layout_height="350dp"
android:layout_centerInParent="true"
android:background="@drawable/feedyr_full" />
<ProgressBar
android:id="@+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/icon"
android:layout_centerHorizontal="true"
android:visibility="visible" />
<include
layout="@layout/helper_error"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/icon"
android:layout_centerHorizontal="true" />
</RelativeLayout>
我的主题看起来像这样。
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:colorButtonNormal">@color/colorAccent</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
也没有什么是我的班级强迫人像
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_placeholder);
config = FirebaseRemoteConfig.getInstance();
model = Model.getInstance();
....
我错过了什么?