我有一个主要活动,我正在其中加载碎片。
我不想要ActionBar,所以我把它隐藏在Manifest中,如下所示
android:theme="@style/NoActionBar"
当我填充片段时,ActionBar被隐藏,但它在屏幕底部给出了黑色部分,我甚至无法在布局中使用该特定部分。
任何帮助?
答案 0 :(得分:1)
用以下代码替换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>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
</resources>
然后将主题设置为
android:theme="@style/AppTheme.NoActionBar"
答案 1 :(得分:0)
在我的项目中,我们使用的是这种风格:
<style name="NoActionBarTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowBackground">@color/black</item>
</style>
在AndroidManifest.xml
中将其设置为
<application ...
android:theme="@style/NoActionBarTheme">...