Android 我能';t从我的应用程序中删除操作栏
我正试图从我的应用程序中删除操作栏,但它就是无法离开。以下是我所做的:Android 我能';t从我的应用程序中删除操作栏,android,xml,android-actionbar,Android,Xml,Android Actionbar,我正试图从我的应用程序中删除操作栏,但它就是无法离开。以下是我所做的: styles.xml <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <!-- Customize your theme here. --> <it
styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" 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>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
应用程序主题设置为“无操作栏”
我也在MainActivity.java
类中这样做:
getActionBar().hide();
但这只会在我运行应用程序时删除它。我希望它在设计面板中消失
这是怎么做到的
但这只会在我运行应用程序时删除它。我希望是这样
在设计面板中消失了
简单地说,在Android Studio的预览版上使用一个没有ActionBar
的主题:
我之所以这么说,是因为你说它在编译应用程序后工作,而你的问题是:
我希望它在设计面板中消失
设计小组
但是,这只会向您展示如何删除Android Studio预览版上的
ActionBar
事情是这样的:
在清单中
:
<android:theme="@android:style/Theme.NoTitleBar">
如果它仍然存在,您应该检查您的
布局中是否有工具栏
您缺少了父属性:
<style name="AppTheme.NoActionBar" parent="AppTheme">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
希望这会有帮助 在这一行转到您的manifest.xml
:
android:theme="@style/AppTheme"
删除Apptheme
,然后键入Theme。用一个点(.)它将显示不同的主题布局选项。
请按照以下图片进行操作:
这将只影响模拟器。为了查看活动\u main.xml
中的效果,只需继续该选项卡活动并按下,形成预览窗口,右上角的按钮“NoActionBar”如下图所示,选择对话框“manifest theme”并点击OK。
这也将改变预览
希望这会有所帮助;) Android Studio的设计面板?清单文件中的MainActivity.java
的主题是什么?您是否为活动设置了“android:theme”?theme.AppCompat.Light.NoActionBar
没有“操作栏”。。。但是AppTheme.NoActionBar
没有扩展该主题…您是否尝试过清单中的android:theme=“@android:style/theme.NoTitleBar”>
?您还可以添加清单吗?
<style name="AppTheme.NoActionBar" parent="AppTheme">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
android:theme="@style/AppTheme.NoActionBar"
android:theme="@style/AppTheme"