如何拥有一个全屏应用程序(没有标题栏) nad对所有设备都有actionbar?当我用
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);如果我将其更改为removed.and,则为actionbar
this.requestWindowFeature(Window.FEATURE_ACTION_BAR | Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);我有一个带有操作栏的全屏应用程序,但是输出如下所示

和myLayout.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="20dip">
<TextView
android:id="@+id/text"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>顺便说一句,我将使用夏洛克,想要ActionItems (夏洛克的样品中的第一项),但没有标题栏。
发布于 2014-07-23 14:06:54
把它放在style.xml上:
<style name="MyTheme" parent="Theme.Sherlock.Light.DarkActionbar">
<item name="android:windowFullScreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>然后像这样在清单中使用:
<activity android:name="MainActivity" android:theme="@style/MyTheme"></activity>发布于 2012-11-20 07:42:29
您必须在themes.xml中更改父样式。
转到@
Library>res>values>abs_themes.xml
打开该文件,将一种代码替换为@
<style name="Sherlock.__Theme" parent="android:Theme.NoTitleBar.Fullscreen">相反,
<style name="Sherlock.__Theme" parent="android:Theme.NoTitleBar">更新的
附加输出屏

发布于 2012-11-20 08:34:43
你所说的所有设备是什么意思?ActionBar是从蜂窝中引入的,它取代了TitleBar。在蜂窝前设备中不能有ActionBar。如果您只是针对蜂窝和以后的设备,Window.FEATURE_NO_TITLE实际上删除了ActionBar,所以请不要使用Window.FEATURE_NO_TITLE使您的ActionBar可见。
https://stackoverflow.com/questions/13467494
复制相似问题