android – WindowActivityBar = false无法正常工作

我正在编写一个将在嵌入式设备上的应用程序,我需要在TitleBar和ContentOverlay旁边删除ActionBar.
我找到了一个解决方案并在我的样式中插入以下内容
<style name="NoActionBar" parent="@android:style/Theme.Holo.Light">
        <item name="android:windowActionBar">false</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowFullscreen">true</item>
        <item name="android:windowContentOverlay">@null</item>
 </style>

并在AndroidManifest中将该行添加到我的活动中:

android:theme="@style/NoActionBar"

最后我没有标题栏,没有内容覆盖,但ActionBar仍然存在.请指教.我使用android:theme =“@ android:style / Theme.Holo.Light”,我的targetSdkVersion是18.

解决方法

XML中的小错误会导致非常奇怪的问题,
这些并不总是由构建过程准确报告.
当我可以在java中完成它时,我倾向于回避改变XML.
Java为您提供更多控制.
programmatically remove action bar
----------------------------------
from normal activity

getActionbar().hide();
getActionbar().show();

if your using support activity

getSupportActionBar().hide();
getSupportActionBar().show();

and from the Fragment you can do it

getActivity().getActionbar().hide();
getActivity().getActionbar().show();

remove title bar
----------------

public class ActivityName extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // remove title
        requestwindowFeature(Window.FEATURE_NO_TITLE);
        getwindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.main);
    }
}

ActionBar ContentOverlay
------------------------
1) Request for actionbar overlay programmatically by calling

       getwindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);

// this 'requestFeature()' must be requested from your activity 'onCreate()' method
// before calling for 'setContentView(R.layout.my_layout)':
2) set the actionbar color by calling setBackgroundDrawable() like so:
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#00212121")) );

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...