Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在我的android设备中隐藏顶部菜单栏&;药片_Android - Fatal编程技术网

在我的android设备中隐藏顶部菜单栏&;药片

在我的android设备中隐藏顶部菜单栏&;药片,android,Android,我想在我的android设备和平板电脑中隐藏顶部菜单栏。有人能告诉我怎么做吗?谢谢你的帮助。你可以通过在你的AndroidManifest.xml中的元素上将android:theme属性设置为@android:style/theme.NoTitleBar来实现这一点,如下所示: <activity android:name=".Activity" android:label="@string/app_name" android:theme="@android:style/

我想在我的android设备和平板电脑中隐藏顶部菜单栏。有人能告诉我怎么做吗?谢谢你的帮助。

你可以通过在你的AndroidManifest.xml中的元素上将android:theme属性设置为@android:style/theme.NoTitleBar来实现这一点,如下所示:

<activity android:name=".Activity"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.NoTitleBar">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

为了隐藏选项卡底部的状态栏,您可以查看此库,我认为这将对您的用例有所帮助。但是,这个库需要一个根设备才能工作,我认为这是您在4.0.1以上版本的设备上工作的唯一情况

另外,对于Android版本<4,在设置布局之前,您可以尝试在
onCreate()
方法中添加以下代码行

WindowManager.LayoutParams attrs = getWindow().getAttributes(); 
attrs.flags = WindowManager.LayoutParams.FLAG_FULLSCREEN; 
getWindow().setAttributes(attrs); 
或者,如果您的应用程序
targetSdk
为11或更高版本(蜂窝和更高版本),则应使用
Holo
样式。因此,在清单中,在
标记中使用属性:

android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" 
对于Android版本2.3.3及以下版本,您可以从清单xml将此添加到您的
应用程序
标记:
Android:theme=“@Android:style/theme.Black.NoTitleBar.Fullscreen”
这将使您的应用程序以全屏模式运行。。如果您想拥有一个标题栏,只需创建一个自定义标题栏并将其放入所有其他活动都将继承的基本活动中即可


我希望这有帮助

如果您试图隐藏导航栏。下面是答案的链接

在活动类中,您可以在onCreate方法中使用此选项。在api级别大于11的情况下

ActionBar actionBar = getActionBar();
actionBar.hide();

加上这个

ActionBar actionBar = getActionBar();
    actionBar.hide();

在styles.xml中添加以下代码行

<item name="android:windowNoTitle">true</item>

到您的清单文件,但您可以通过在styles.xml中添加行来保留自己的自定义样式。为了便于搜索者,在Android Studio中创建项目时,您的AndroidManifest.xml(如@Jay所示)将引用“AppTheme”,如下所示:

<application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
...

从一开始不显示比先显示再隐藏好。您可以通过在应用程序块主AndroidManifest.xml文件中定义NoActionBar主题来禁用顶部标题ActionBar菜单的显示:


android:theme=“@style/AppTheme.NoActionBar”

查看此内容,包括
android:theme=“@android:style/theme.NoTitleBar”
在您的
标签中的AndroidManifest.file在我的平板电脑设备的底部,有一个导航栏,包括后退按钮、主页按钮、,信号和电池等。我想隐藏导航栏。怎么做?真的!!!你想隐藏返回和主页按钮!!!!!在actionBar.hide()行获取空指针异常;getSupportActionBar().hide();没有此类方法getSupportActionBar()。它在getSupportActionBar()行显示错误。隐藏();我需要为我的android平板电脑设置根目录?有人理解我的问题吗?我试过了,但它给了我一个gradle构建错误:“java.lang.IllegalStateException:你需要在这个活动中使用Theme.AppCompat主题(或后代)。
android:Theme=“@style/Theme.AppCompat.NoActionBar”
对我有效
android:theme="@android:style/Theme.NoTitleBar"
<application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
...
<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
    </style>

</resources>