在启动过程中,然后再次显示它Android-隐藏动作条?过程中、动作、Android

2023-09-12 02:47:10 作者:贱必有天收 ﹏

我的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>