无法更改清单中的主题

Can't change theme in Manifest

我在学习,遇到了简单的问题,即删除 Android 的操作栏并将应用程序设置为全屏。整个应用程序应该全屏显示,所以我从 Manifest

开始
<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen">
    <activity
        android:name=".Main"
        android:screenOrientation="landscape"
        android:configChanges="orientation|keyboardHidden|screenSize"
        android:label="@string/app_name"
        android:theme="@style/FullscreenTheme">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

UI 完全一样= Stuck at default Look. 好吧,接下来我尝试在 Android studio GUI 中为 activity_main.xml 屏幕更改外观。这改变了设计预览,但对实际应用没有影响。还是一样。这是要更改应用程序还是只是设计预览?

我尝试在

中进行更改
<activity
        android:name=".Main"
        android:screenOrientation="landscape"
        android:configChanges="orientation|keyboardHidden|screenSize"
        android:label="@string/app_name"
        android:theme="@style/FullscreenTheme">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

:theme@android:style/Theme.Holo.Light.NoActionBar.Fullscreen 但现在应用程序在启动时崩溃。

我也试过在 styles.xml 中制作自定义主题,像这样

<style name="CustomMyTheme" parent="AppTheme">
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
</style>

但结果相同。我不明白为什么在清单中更改主题不起作用。 api 版本有冲突吗?最小值设置为 15、26 目标和 22 模拟器版本。

使用以下主题将应用程序或任何 activity 设置为全屏

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

您也可以从 Javacod 进行。在您的 onCreate() 中添加此代码;在 super.onCreate(savedInstanceState);

之前
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
    WindowManager.LayoutParams.FLAG_FULLSCREEN);

尝试在您的 activity 中使用此代码。在setContentView().

之前调用函数
private void setFullScreen() {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(
                WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN
        );
    }