的Andr​​oid(3.0)操作栏不想去想去、操作、Andr、oid

2023-09-12 01:54:24 作者:做自己的女王ァ

我正与XOOM并试图隐藏操作栏。所以我按照指示做了以下 清单文件:

I am working with XOOM and trying to hide action bar. So i follow the instruction did the following in manifest file:

使用-SDK安卓的minSdkVersion =11机器人:targetSdkVersion =11

uses-sdk android:minSdkVersion="11" android:targetSdkVersion="11"

还设置活动的主题。

机器人:主题=@安卓风格/ Theme.Holo.NoActionBar

android:theme="@android:style/Theme.Holo.NoActionBar"

不幸的是我仍然可以看到操作栏。所以我从我的清单中删除的全息动作部分,并添加以下code

unfortunately i can still see the action bar. so i remove the holo action part from my manifest and added following code

动作条动作条= getActionBar();         actionBar.hide();

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

获得来自隐藏()方法的空指针异常。我是这么理解getActionBar()的返回null。现在我很好奇什么,我缺少什么?

getting null pointer exception from hide() method. so i understand getActionBar() is returning null. Now i am curious what i am missing?

推荐答案

Theme.Holo.NoActionBar是不公开的框架 - 相反,你可以宣布自己的风格是这样的:

Theme.Holo.NoActionBar isn't public in the framework- Instead, you can declare your own style like this:

<style name="MyTheme" parent="@android:style/Theme.Holo.Light">
        <item name="android:windowActionBar">false</item>
        <item name="android:windowNoTitle">true</item>
</style>