安卓:如何删除活动标题栏? [英] Android: How to remove the Activity Title Bar?

查看:114
本文介绍了安卓:如何删除活动标题栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想摆脱的活动标题栏,因为它很讨厌有。不过,我不希望有一个全屏activity.I曾尝试只需添加 @android:风格/ Theme.NoTitleBar 来的活动和安卓主题=@安卓风格/ Theme.NoTitleBar.Fullscreen 来的清单文件,但我不断收到错误: java.lang.IllegalStateException:您需要使用一个主题。应用程序兼容性主题(或后代)本活动,似乎没有任何帮助。

I am wanting to get rid of the Activity Title Bar as it is annoying to have. However, I do not want to have a fullscreen activity.I have tried just adding @android:style/Theme.NoTitleBar to activity and android:theme="@android:style/Theme.NoTitleBar.Fullscreen to the manifest file, but I keep getting the error: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. Nothing seems to help.

任何帮助将是美妙的:)

Any help would be wonderful :)

谢谢!

推荐答案

试试这个code:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // remove title bar
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);

    // remove notification bar 
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_WindowManager.LayoutParams.FLAG_FULLSCREEN);

    setContentView(R.layout.activity_splash);
}

这篇关于安卓:如何删除活动标题栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆