首页 > 解决方案 > Android Studio 选择布局不起作用(Material.NoActionBar.Fullscreen)

问题描述

我在 Android Studio 中选择了 Material.NoActionBar.Fullscreen,我喜欢这种设计,但是如果我启动我的应用程序,它会带有操作栏和明亮的背景。

选择 Material.NoActionBar.... 设计后,我的 style.xml 看起来没有任何变化。

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

怎么可能使用这种设计?

注意:我的 API 是 28,所以这应该不是问题

标签: androidlayoutstyles

解决方案


对不起!,将代码更改为:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    getSupportActionBar().hide();
    setContentView(R.layout.activity_main);
}

推荐阅读