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


Java View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR屬性代碼示例

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


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

示例1: processM

@TargetApi(Build.VERSION_CODES.M)
private void processM() {

  if (current < Build.VERSION_CODES.M) {
    return;
  }
  int flag = window.getDecorView().getSystemUiVisibility();
  if (lightStatusBar) {
    /**
     * 改變字體顏色
     * see {@link <a href="https://developer.android.com/reference/android/R.attr.html#windowLightStatusBar"></a>}
     */
    flag |= (WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
        | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
    window.setStatusBarColor(Color.TRANSPARENT);
  }
  if (transparentStatusBar) {
    flag |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
    window.setStatusBarColor(Color.TRANSPARENT);
  }
  if (transparentNavigationbar) {
    flag |= (View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    window.setNavigationBarColor(Color.TRANSPARENT);
  }
  window.getDecorView().setSystemUiVisibility(flag);
}
 
開發者ID:MUFCRyan,項目名稱:BilibiliClient,代碼行數:26,代碼來源:StatusBarUtil.java

示例2: activateLightStatusBar

/**
 * Sets the status bar to be light or not. Light status bar means dark icons.
 * @param activate if true, make sure the status bar is light, otherwise base on wallpaper.
 */
public void activateLightStatusBar(boolean activate) {
    boolean lightStatusBar = activate || (FeatureFlags.LIGHT_STATUS_BAR
            && mExtractedColors.getColor(ExtractedColors.STATUS_BAR_INDEX,
            ExtractedColors.DEFAULT_DARK) == ExtractedColors.DEFAULT_LIGHT);
    int oldSystemUiFlags = getWindow().getDecorView().getSystemUiVisibility();
    int newSystemUiFlags = oldSystemUiFlags;
    if (lightStatusBar) {
        newSystemUiFlags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
    } else {
        newSystemUiFlags &= ~(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
    }
    if (newSystemUiFlags != oldSystemUiFlags) {
        getWindow().getDecorView().setSystemUiVisibility(newSystemUiFlags);
    }
}
 
開發者ID:TeamBrainStorm,項目名稱:SimpleUILauncher,代碼行數:19,代碼來源:Launcher.java

示例3: activateLightSystemBars

/**
 * Sets the status and/or nav bar to be light or not. Light status bar means dark icons.
 * @param isLight make sure the system bar is light.
 * @param statusBar if true, make the status bar theme match the isLight param.
 * @param navBar if true, make the nav bar theme match the isLight param.
 */
@TargetApi(23)
public void activateLightSystemBars(boolean isLight, boolean statusBar, boolean navBar) {
    int oldSystemUiFlags = getWindow().getDecorView().getSystemUiVisibility();
    int newSystemUiFlags = oldSystemUiFlags;
    if (isLight) {
        if (statusBar) {
            newSystemUiFlags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
        }
        if (navBar && AndroidVersion.isAtLeastOreo()) {
            newSystemUiFlags |= SYSTEM_UI_FLAG_LIGHT_NAV_BAR;
        }
    } else {
        if (statusBar) {
            newSystemUiFlags &= ~(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
        }
        if (navBar && AndroidVersion.isAtLeastOreo()) {
            newSystemUiFlags &= ~(SYSTEM_UI_FLAG_LIGHT_NAV_BAR);
        }
    }

    if (newSystemUiFlags != oldSystemUiFlags) {
        getWindow().getDecorView().setSystemUiVisibility(newSystemUiFlags);
    }
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:30,代碼來源:Launcher.java

示例4: setOPPOStatusBar

/**
 * OPPO低版本係統(處理白色狀態欄黑色字體兼容問題)
 * 詳細問題請參照OPPO開放平台:https://open.oppomobile.com/wiki/index#id=73494
 * @param darkMode
 * @param activity
 */
public void setOPPOStatusBar(boolean darkMode,Activity activity) {
    final int SYSTEM_UI_FLAG_OP_STATUS_BAR_TINT = 0x00000010;
    Window window = activity.getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    int vis = window.getDecorView().getSystemUiVisibility();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        if (darkMode) {
            vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
        } else {
            vis |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
        }
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES. KITKAT) {
        if (darkMode) {
            vis &= ~SYSTEM_UI_FLAG_OP_STATUS_BAR_TINT;
        } else {
            vis |= SYSTEM_UI_FLAG_OP_STATUS_BAR_TINT;
        }
    }
    window.getDecorView().setSystemUiVisibility(vis);
}
 
開發者ID:hushengjun,項目名稱:FastAndroid,代碼行數:26,代碼來源:UIStatusBarController.java

示例5: onItemClick

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    switch (Item.values()[position]) {
        case 默認主題:
            mToolbar.setBackgroundResource(android.R.color.white);
            mToolbar.setTitleTextColor(0xffbbbbbb);
            mToolbar.setNavigationIcon(R.drawable.ic_arrow_back_gray_24dp);
            mRefreshLayout.setPrimaryColors(0xfff0f0f0, 0xffffffff);
            if (Build.VERSION.SDK_INT >= 21) {
                getWindow().setStatusBarColor(0xfff0f0f0);
            }
            if (Build.VERSION.SDK_INT >= 23) {
                Window window = getWindow();
                int systemUiVisibility = window.getDecorView().getSystemUiVisibility();
                systemUiVisibility |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
                window.getDecorView().setSystemUiVisibility(systemUiVisibility);
            }
            break;
        case 藍色主題:
            setThemeColor(R.color.colorPrimary, R.color.colorPrimaryDark);
            break;
        case 綠色主題:
            setThemeColor(android.R.color.holo_green_light, android.R.color.holo_green_dark);
            break;
        case 紅色主題:
            setThemeColor(android.R.color.holo_red_light, android.R.color.holo_red_dark);
            break;
        case 橙色主題:
            setThemeColor(android.R.color.holo_orange_light, android.R.color.holo_orange_dark);
            break;
    }
    mRefreshLayout.autoRefresh();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:33,代碼來源:DeliveryStyleActivity.java

示例6: setThemeColor

private void setThemeColor(int colorPrimary, int colorPrimaryDark) {
    mToolbar.setBackgroundResource(colorPrimary);
    mToolbar.setTitleTextColor(ContextCompat.getColor(this, android.R.color.white));
    mToolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
    mRefreshLayout.setPrimaryColorsId(colorPrimary, android.R.color.white);
    if (Build.VERSION.SDK_INT >= 21) {
        getWindow().setStatusBarColor(ContextCompat.getColor(this, colorPrimaryDark));
    }
    if (Build.VERSION.SDK_INT >= 23) {
        Window window = getWindow();
        int systemUiVisibility = window.getDecorView().getSystemUiVisibility();
        systemUiVisibility &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
        window.getDecorView().setSystemUiVisibility(systemUiVisibility);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:DeliveryStyleActivity.java

示例7: darkModeForM

/** android 6.0設置字體顏色 */
    @RequiresApi(Build.VERSION_CODES.M)
    private static void darkModeForM(Window window, boolean dark) {
//        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();
        if (dark) {
            systemUiVisibility |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
        } else {
            systemUiVisibility &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
        }
        window.getDecorView().setSystemUiVisibility(systemUiVisibility);
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:StatusBarUtil.java

示例8: setWindowLightStatusBar

public static void setWindowLightStatusBar(Activity activity, Boolean lightStatusBar) {
  Window window = activity.getWindow();
  View decor = window.getDecorView();
  //取消設置透明狀態欄,使 ContentView 內容不再覆蓋狀態欄
  window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
  //需要設置這個 flag 才能調用 setStatusBarColor 來設置狀態欄顏色
  window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
  int ui = decor.getSystemUiVisibility();
  if (lightStatusBar) {
    ui |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
  } else {
    ui &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
  }
  decor.setSystemUiVisibility(ui);
}
 
開發者ID:Lingzh0ng,項目名稱:BrotherWeather,代碼行數:15,代碼來源:StatusBarTextColorUtils.java

示例9: setStatusBarDarkModeForM

/**
 * android 6.0設置字體顏色
 */
@TargetApi(Build.VERSION_CODES.M)
public static void setStatusBarDarkModeForM(Window window) {

  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_LIGHT_STATUS_BAR;
  window.getDecorView().setSystemUiVisibility(systemUiVisibility);
}
 
開發者ID:MUFCRyan,項目名稱:BilibiliClient,代碼行數:14,代碼來源:SystemBarHelper.java

示例10: Android6SetStatusBarLightMode

/**
 * 設置狀態欄字體圖標為深色,Android 6
 *
 * @param window 需要設置的窗口
 * @param light  是否把狀態欄字體及圖標顏色設置為深色
 * @return boolean 成功執行返回true
 */
@TargetApi(23)
private static boolean Android6SetStatusBarLightMode(Window window, boolean light) {
    View decorView = window.getDecorView();
    int systemUi = light ? View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR : View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
    systemUi = changeStatusBarModeRetainFlag(window, systemUi);
    decorView.setSystemUiVisibility(systemUi);
    return true;
}
 
開發者ID:QMUI,項目名稱:QMUI_Android,代碼行數:15,代碼來源:QMUIStatusBarHelper.java

示例11: clearLightStatusBar

public static void clearLightStatusBar(@NonNull View view) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        int flags = view.getSystemUiVisibility();
        flags &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
        view.setSystemUiVisibility(flags);
    }
}
 
開發者ID:xxczaki,項目名稱:music-player,代碼行數:7,代碼來源:ViewUtils.java

示例12: setLightStatusBar

public static void setLightStatusBar(View view, Activity activity) {

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            View decor = activity.getWindow().getDecorView();
            oldStatusBarFlags = decor.getSystemUiVisibility();
            int flags = view.getSystemUiVisibility();
            flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
            view.setSystemUiVisibility(flags);
            activity.getWindow().setStatusBarColor(Color.WHITE);
        }


    }
 
開發者ID:cahergil,項目名稱:Farmacias,代碼行數:13,代碼來源:Utils.java

示例13: setLightStatusBar

public static void setLightStatusBar(@NonNull View view) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        int flags = view.getSystemUiVisibility();
        flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
        view.setSystemUiVisibility(flags);
    }
}
 
開發者ID:haihaio,項目名稱:AmenEye,代碼行數:7,代碼來源:ViewUtil.java

示例14: enableLightStatusBar

public static void enableLightStatusBar(Activity activity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        View view = activity.getWindow().getDecorView();

        int flags = view.getSystemUiVisibility();
        flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
        view.setSystemUiVisibility(flags);
    }
}
 
開發者ID:OhMyLob,項目名稱:Paper-Launcher,代碼行數:9,代碼來源:SystemBarUtil.java

示例15: clearLightStatusBar

public static void clearLightStatusBar(Activity activity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        View view = activity.getWindow().getDecorView();

        int flags = view.getSystemUiVisibility();
        flags &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
        view.setSystemUiVisibility(flags);
    }
}
 
開發者ID:OhMyLob,項目名稱:Paper-Launcher,代碼行數:9,代碼來源:SystemBarUtil.java


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