當前位置: 首頁>>代碼示例>>Java>>正文


Java View.SYSTEM_UI_FLAG_LAYOUT_STABLE屬性代碼示例

本文整理匯總了Java中android.view.View.SYSTEM_UI_FLAG_LAYOUT_STABLE屬性的典型用法代碼示例。如果您正苦於以下問題:Java View.SYSTEM_UI_FLAG_LAYOUT_STABLE屬性的具體用法?Java View.SYSTEM_UI_FLAG_LAYOUT_STABLE怎麽用?Java View.SYSTEM_UI_FLAG_LAYOUT_STABLE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.view.View的用法示例。


在下文中一共展示了View.SYSTEM_UI_FLAG_LAYOUT_STABLE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createHideFlags

@Override
protected int createHideFlags() {
    int flag = super.createHideFlags();

    if (mLevel >= SystemUiHelper.LEVEL_HIDE_STATUS_BAR) {
        flag |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_FULLSCREEN;

        if (mLevel >= SystemUiHelper.LEVEL_LEAN_BACK) {
            flag |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
        }
    }

    return flag;
}
 
開發者ID:h4h13,項目名稱:RetroMusicPlayer,代碼行數:16,代碼來源:SystemUiHelperImplJB.java

示例2: onCreate

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    changeTheme((String) SPUtils.get(this, AppConfig.choose_theme, AppConfig.DEFAULT_COLOR));
    super.onCreate(savedInstanceState);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        WindowManager.LayoutParams localLayoutParams = getWindow().getAttributes();
        localLayoutParams.flags = (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | localLayoutParams.flags);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            View decorView = getWindow().getDecorView();
            int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
            decorView.setSystemUiVisibility(option);
        }
    }
}
 
開發者ID:lanyuanxiaoyao,項目名稱:PicKing,代碼行數:16,代碼來源:BaseActivity.java

示例3: onCreate

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
    initTheme();
    setContentView(R.layout.detail_layout);
    //將狀態欄透明
    if(Build.VERSION.SDK_INT>=21){
        View decorView = getWindow().getDecorView();
        int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN|
                View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
        decorView.setSystemUiVisibility(option);
        getWindow().setStatusBarColor(Color.TRANSPARENT);
    }

    init();
    fillContent();
}
 
開發者ID:ChenTianSaber,項目名稱:DailyZhiHu,代碼行數:18,代碼來源:DetaiContentActivity.java

示例4: toggleHideyBar

public static void toggleHideyBar(Activity activity, boolean onResume) {

        int newUiOptions = activity.getWindow().getDecorView().getSystemUiVisibility();

        if (onResume) {

            applyImmersiveMode(activity);

        } else {
            newUiOptions ^= View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
            newUiOptions ^= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
            newUiOptions ^= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
            newUiOptions ^= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

            newUiOptions ^= View.SYSTEM_UI_FLAG_FULLSCREEN;
            newUiOptions ^= View.SYSTEM_UI_FLAG_IMMERSIVE;
            newUiOptions ^= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
            activity.getWindow().getDecorView().setSystemUiVisibility(newUiOptions);
        }
    }
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:20,代碼來源:ImmersiveUtils.java

示例5: onCreate

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_waiting_future);
    View decorView = getWindow().getDecorView();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
        decorView.setSystemUiVisibility(option);
        getWindow().setStatusBarColor(Color.TRANSPARENT);
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        Window window = getWindow();
        // Translucent status bar
        window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager
                .LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setTitle(R.string.waitforTitle);
    //using butter knife
    ButterKnife.bind(this);
}
 
開發者ID:Luodian,項目名稱:Shared-Route,代碼行數:22,代碼來源:WaitingFutureActivity.java

示例6: enterFullScreen

private void enterFullScreen() {
    if(mToolbar == null || rootView == null || bottomView == null) return;

    //bottomView.setVisibility(View.GONE);

    int flag = View.SYSTEM_UI_FLAG_LOW_PROFILE;
    if(ApiHelper.HAS_VIEW_SYSTEM_UI_FLAG_LAYOUT_STABLE)
        flag = View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;

    mToolbar.setVisibility(View.INVISIBLE);
    rootView.setSystemUiVisibility(flag);
    fullScreen = true;
}
 
開發者ID:YuntaoWei,項目名稱:PictureShow,代碼行數:13,代碼來源:PhotoActivity.java

示例7: setBarColor

/**
 * 設置狀態欄背景色
 * 4.4以下不處理
 * 4.4使用默認沉浸式狀態欄
 *
 * @param color 要為狀態欄設置的顏色值
 */
public static void setBarColor(Activity activity, int color) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        Window win = activity.getWindow();
        View decorView = win.getDecorView();
        win.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);//沉浸式狀態欄(4.4-5.0透明,5.0以上半透明)
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {//android5.0以上設置透明效果
            win.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);//清除flag,為了android5.0以上也全透明效果
            //讓應用的主體內容占用係統狀態欄的空間
            int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
            decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() | option);
            win.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            win.setStatusBarColor(color);//設置狀態欄背景色
        }
    }
}
 
開發者ID:Horrarndoo,項目名稱:YiZhi,代碼行數:23,代碼來源:StatusBarUtils.java

示例8: setStyle

private void setStyle() {
    if (Build.VERSION.SDK_INT >= 21) {
        View decorView = getWindow().getDecorView();
        int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
        decorView.setSystemUiVisibility(option);
        getWindow().setStatusBarColor(Color.TRANSPARENT);
    }
}
 
開發者ID:lijunyandev,項目名稱:MeetMusic,代碼行數:9,代碼來源:PlayActivity.java

示例9: tintStatusBarForDrawer

/**
 * Android4.4以上的狀態欄著色(針對於DrawerLayout)
 * 注:
 * 1.如果出現界麵展示不正確,刪除布局中所有fitsSystemWindows屬性,尤其是DrawerLayout的fitsSystemWindows屬性
 * 2.可以版本判斷在5.0以上不調用該方法,使用係統自帶
 *
 * @param activity Activity對象
 * @param drawerLayout DrawerLayout對象
 * @param statusBarColor 狀態欄顏色
 * @param alpha 透明欄透明度[0.0-1.0]
 */
public static void tintStatusBarForDrawer(Activity activity, DrawerLayout drawerLayout,
                                          @ColorInt int statusBarColor,
                                          @FloatRange(from = 0.0, to = 1.0) float alpha) {

  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
    return;
  }

  Window window = activity.getWindow();
  ViewGroup decorView = (ViewGroup) window.getDecorView();
  ViewGroup drawContent = (ViewGroup) drawerLayout.getChildAt(0);

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    window.setStatusBarColor(Color.TRANSPARENT);
    drawerLayout.setStatusBarBackgroundColor(statusBarColor);

    int systemUiVisibility = window.getDecorView().getSystemUiVisibility();
    systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
    systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
    window.getDecorView().setSystemUiVisibility(systemUiVisibility);
  } else {
    window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
  }

  setStatusBar(decorView, statusBarColor, true, true);
  setTranslucentView(decorView, alpha);

  drawerLayout.setFitsSystemWindows(false);
  drawContent.setFitsSystemWindows(true);
  ViewGroup drawer = (ViewGroup) drawerLayout.getChildAt(1);
  drawer.setFitsSystemWindows(false);
}
 
開發者ID:WeDevelopTeam,項目名稱:HeroVideo-master,代碼行數:45,代碼來源:SystemBarHelper.java

示例10: _setImmersiveMode

@TargetApi(19)
private void _setImmersiveMode(){
	//if (true) return;
	int vis = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
			| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
			| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
			| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
			| View.SYSTEM_UI_FLAG_FULLSCREEN
			| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
	if (mGLView.getSystemUiVisibility() != vis){
		//screenMessage("FORCING IMMERSIVE");
		mGLView.setSystemUiVisibility(vis);
	}
}
 
開發者ID:efroemling,項目名稱:bombsquad-remote-android,代碼行數:14,代碼來源:GamePadActivity.java

示例11: onCreate

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_welcome);
    View decorView = getWindow().getDecorView();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
        decorView.setSystemUiVisibility(option);
        getWindow().setStatusBarColor(Color.TRANSPARENT);
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        // 透明狀態欄
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        // 透明導航欄
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        // 設置狀態欄顏色
        getWindow().setBackgroundDrawableResource(R.color.colorPrimary);
    }
    Handler handler = new Handler();
    //當計時結束,跳轉至主界麵
    handler.postDelayed(new Runnable() {
        @Override
        public void run() {
            Intent intent = new Intent(WelcomeActivity.this, LoginActivity.class);
            startActivity(intent);
            WelcomeActivity.this.finish();
        }
    }, 3000);
}
 
開發者ID:Luodian,項目名稱:Shared-Route,代碼行數:30,代碼來源:WelcomeActivity.java

示例12: initStatusBar

public View initStatusBar() {
    FrameLayout frameLayout = findViewById(R.id.frame_layout);
    Window window = getWindow();
    ViewGroup decorView = (ViewGroup) window.getDecorView();
    int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;

    int finalColor = Color.argb(50, Color.TRANSPARENT, Color.TRANSPARENT, Color.TRANSPARENT);
    window.setStatusBarColor(finalColor);
    View statusView = createStatusBarView(this, ContextCompat.getColor(this, R.color.colorPrimary));
    frameLayout.addView(statusView);
    decorView.setSystemUiVisibility(option);
    return statusView;
}
 
開發者ID:MoonRiser,項目名稱:MaterialLearning,代碼行數:14,代碼來源:MainActivity.java

示例13: setStatusBar

/**
 * 設置狀態欄顏色
 */
private void setStatusBar() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        View decorView = getWindow().getDecorView();
        int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
        decorView.setSystemUiVisibility(option);
        getWindow().setStatusBarColor(getResources().getColor(R.color.colorPrimary));
    }else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }
}
 
開發者ID:miguoer,項目名稱:ApplicationCollention,代碼行數:13,代碼來源:BaseActivity.java

示例14: immersiveStatusBar

/**
 * Android4.4以上的沉浸式全屏模式
 * 注:
 * 1.刪除fitsSystemWindows屬性:Android5.0以上使用該方法如果出現界麵展示不正確,刪除布局中所有fitsSystemWindows屬性
 * 或者調用forceFitsSystemWindows方法
 * 2.不刪除fitsSystemWindows屬性:也可以區別處理,Android5.0以上使用自己的方式實現,不調用該方法
 *
 * @param window 一般都是用於Activity的window,也可以是其他的例如Dialog,DialogFragment
 * @param alpha 透明欄透明度[0.0-1.0]
 */
public static void immersiveStatusBar(Window window,
                                      @FloatRange(from = 0.0, to = 1.0) float alpha) {

  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
    return;
  }

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    window.setStatusBarColor(Color.TRANSPARENT);

    int systemUiVisibility = window.getDecorView().getSystemUiVisibility();
    systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
    systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
    window.getDecorView().setSystemUiVisibility(systemUiVisibility);
  } else {
    window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
  }

  ViewGroup decorView = (ViewGroup) window.getDecorView();
  ViewGroup contentView = (ViewGroup) window.getDecorView()
      .findViewById(Window.ID_ANDROID_CONTENT);
  View rootView = contentView.getChildAt(0);
  int statusBarHeight = getStatusBarHeight(window.getContext());
  if (rootView != null) {
    FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) rootView.getLayoutParams();
    ViewCompat.setFitsSystemWindows(rootView, true);
    lp.topMargin = -statusBarHeight;
    rootView.setLayoutParams(lp);
  }

  setTranslucentView(decorView, alpha);
}
 
開發者ID:MUFCRyan,項目名稱:BilibiliClient,代碼行數:44,代碼來源:SystemBarHelper.java

示例15: setFullScreen

private void setFullScreen() {
	try {
		if (Build.VERSION.SDK_INT < 19) {
			getWindow().setFlags(
					WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER,
					WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER
			);
		} else {
			View decorView = getWindow().getDecorView();

			int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
					| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
					| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
					| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
					| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
					| View.SYSTEM_UI_FLAG_IMMERSIVE;

			decorView.setSystemUiVisibility(uiOptions);

			getWindow().setFlags(
					WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER,
					WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER
			);
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:alescdb,項目名稱:LauncherTV,代碼行數:28,代碼來源:Launcher.java


注:本文中的android.view.View.SYSTEM_UI_FLAG_LAYOUT_STABLE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。