简体   繁体   English

隐藏和显示操作栏元素消失了

[英]Hide and Show Actionbar elements disappeared

I need hide ActionBar at one precise moment hide the ActionBar and place the app in fullscreen, so hide the view of the elements like text view. 我需要在某一时刻隐藏ActionBar,然后隐藏ActionBar并将应用程序置于全屏状态,因此要隐藏诸如文本视图之类的元素的视图。 The problem is that when I go back to normal mode the textview is behind the ActionBar. 问题是当我回到正常模式时,textview位于ActionBar的后面。

Does anyone have any idea how can I fix this? 有谁知道如何解决这个问题?

    int uiOptions;
    mView = this.getWindow().getDecorView();
    TextView text = (TextView) findViewById(R.id.textName);

    if (enabled) {
        text.setVisibility(View.INVISIBLE);
        uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
        mView.setSystemUiVisibility(uiOptions);
        getSupportActionBar().hide();
        customHandler.postDelayed(updateTimerThread, 1000);

    } else {
        text.setVisibility(View.VISIBLE);
        uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
        mView.setSystemUiVisibility(uiOptions);
        getSupportActionBar().show();
        customHandler.removeCallbacks(updateTimerThread);
        if (mMenu != null) {
            mMenu.setTitle(R.string.menu_start);
        }
        mView.setBackgroundColor(Color.WHITE);
    }

只需将元素放置在ActionBar可见并起作用后就保持可见!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM