android - 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,所以这应该不是问题
解决方案
对不起!,将代码更改为:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
getSupportActionBar().hide();
setContentView(R.layout.activity_main);
}
推荐阅读
- python - 创建或增加现有实例的 UpdateView
- html - 在输入下对齐错误消息 - HTML/CSS
- rust - Rust 编译器错误 - “可能缺少 crate ...”
- webview2 - WebView2 - 使用 HtmlTextWriter 更新 innerHTML
- c# - 源代码生成:如何从 InvocationExpressionSyntax 获取涉及的类型
- angular - 如何在 Angular 10 中急切加载离子模式
- css-selectors - 当我将鼠标悬停在子元素上时,它不会选择之前出现的相同级别的子元素
- amazon-web-services - 您可以在 AWS 策略中使用私有 IP 地址吗?
- python - Python:方括号内的括号(列表)
- aws-cdk - 您如何检测哪个 sourceAction 触发了 CodePipeline 执行