在启动过程中,然后再次显示它Android-隐藏动作条? [英] Android- hide actionbar during startup and then show it again?

查看:100
本文介绍了在启动过程中,然后再次显示它Android-隐藏动作条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Andr​​oid应用程序,具有使用操作栏标签导航。它运作良好,但困扰我的应用程序的第一个启动过程中,一个小的默认操作栏简要正在取代真实,标签导航操作栏之前出现了。我的onCreate开始是这样的:

My android app has tab navigation using an action bar. It works well, but it bothers me that during the first boot of the app, a small default action bar briefly shows up before being replaced by the real, tab-navigation action bar. My onCreate starts like this:

    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    setContentView(R.layout.activity_main);

    //Set up the actionbar
    final ActionBar actionBar = getActionBar();
.
.
.

什么我必须这样做,真正的动作条会不小的默认初始化1简略地表示它在启动时过吗?

What do I have to do so that the real actionbar will be initialized without a small default one briefly showing before it does on startup?

感谢

推荐答案

在启动过程中隐藏

 getSupportActionBar().hide();

后,您可以再次...显示它

After you can show it again with ...

 getSupportActionBar().show();

这应该是相同的与Android原生的ActionBar。

It should be the same with native ActionBar of Android.

您应该使用此行的表现和不使用getActionBar()

you should use this line in manifest and don't use getActionBar()

<item name="android:windowActionBar">false</item>

和一旦它的下面有或全无的主要活动使用的成品

and once it's finished in the main Activity use below or nothing

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

这篇关于在启动过程中,然后再次显示它Android-隐藏动作条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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