如何通过编程在Samsung S8上启用导航栏?

时间:2017-09-15 07:12:22

标签: android

我在Samsung S8.上构建应用程序。我的应用程序运行时需要启用导航栏。 我想出了一种隐藏导航栏的方法sept 4 00:00:00 ntp[123]: respawned or started sept 4 00:00:01 dhcp[234]: respawned or started sept 4 00:00:05 ntp[345]: respawned or started sept 4 00:00:08 bash[555]: respawned or started sept 4 00:00:10 bash[556]: respawned or started 。怎么展示 导航栏?

1 个答案:

答案 0 :(得分:0)

取自:https://developer.android.com/reference/android/view/View.html#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION

void setNavVisibility(boolean visible) {
        int newVis = SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | SYSTEM_UI_FLAG_LAYOUT_STABLE;
        if (!visible) {
            newVis |= SYSTEM_UI_FLAG_LOW_PROFILE | SYSTEM_UI_FLAG_FULLSCREEN
                    | SYSTEM_UI_FLAG_HIDE_NAVIGATION;
        }

        // If we are now visible, schedule a timer for us to go invisible.
        if (visible) {
            Handler h = getHandler();
            if (h != null) {
                h.removeCallbacks(mNavHider);
                if (!mMenusOpen && !mPaused) {
                    // If the menus are open or play is paused, we will not auto-hide.
                    h.postDelayed(mNavHider, 3000);
                }
            }
        }

        // Set the new desired visibility.
        setSystemUiVisibility(newVis);
        mTitleView.setVisibility(visible ? VISIBLE : INVISIBLE);
        mPlayButton.setVisibility(visible ? VISIBLE : INVISIBLE);
        mSeekView.setVisibility(visible ? VISIBLE : INVISIBLE);
}

这应该描述你在寻找什么。