Java Code Examples for com.readystatesoftware.systembartint.SystemBarTintManager#setStatusBarTintResource()
The following examples show how to use
com.readystatesoftware.systembartint.SystemBarTintManager#setStatusBarTintResource() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ThreeActivity.java From ImmersiveStatusBar with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_three); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { //透明状态栏 getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); //透明导航栏 getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); SystemBarTintManager tintManager = new SystemBarTintManager(this); // 激活状态栏 tintManager.setStatusBarTintEnabled(true); // enable navigation bar tint 激活导航栏 tintManager.setNavigationBarTintEnabled(true); //设置系统栏设置颜色 //tintManager.setTintColor(R.color.red); //给状态栏设置颜色 tintManager.setStatusBarTintResource(R.color.mask_tags_1); //Apply the specified drawable or color resource to the system navigation bar. //给导航栏设置资源 tintManager.setNavigationBarTintResource(R.color.mask_tags_1); } }
Example 2
Source File: StatusBarUtil.java From FimiX8-RE with MIT License | 5 votes |
public static void setStatusBarColor(Activity activity, int colorId) { if (VERSION.SDK_INT >= 21) { Window window = activity.getWindow(); window.addFlags(NTLMConstants.FLAG_UNIDENTIFIED_9); window.getDecorView().setSystemUiVisibility(FimiAppContext.UI_HEIGHT); } else if (VERSION.SDK_INT >= 19) { transparencyBar(activity); SystemBarTintManager tintManager = new SystemBarTintManager(activity); tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintResource(colorId); } }
Example 3
Source File: RxBarTool.java From RxTools-master with Apache License 2.0 | 5 votes |
/** * 修改状态栏颜色,支持4.4以上版本 * * @param activity * @param colorId */ public static void setStatusBarColor(Activity activity, int colorId) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = activity.getWindow(); // window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(activity.getResources().getColor(colorId)); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { //使用SystemBarTint库使4.4版本状态栏变色,需要先将状态栏设置为透明 transparencyBar(activity); SystemBarTintManager tintManager = new SystemBarTintManager(activity); tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintResource(colorId); } }
Example 4
Source File: BaseActivity.java From enjoyshop with Apache License 2.0 | 5 votes |
/** * 沉浸式状态栏. */ public void initSystemBar(Activity activity) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { setTranslucentStatus(activity, true); } SystemBarTintManager tintManager = new SystemBarTintManager(activity); tintManager.setStatusBarTintEnabled(true); // 使用颜色资源 tintManager.setStatusBarTintResource(R.color.colorPrimary); }
Example 5
Source File: StatusBarUtil.java From PaintView with MIT License | 5 votes |
/** * 修改状态栏颜色,支持4.4以上版本 * @param activity * @param colorId */ public static void setStatusBarColor(Activity activity,int colorId) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = activity.getWindow(); window.setStatusBarColor(activity.getResources().getColor(colorId)); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { //使用SystemBarTint库使4.4版本状态栏变色,需要先将状态栏设置为透明 transparencyBar(activity); SystemBarTintManager tintManager = new SystemBarTintManager(activity); tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintResource(colorId); } }
Example 6
Source File: BaseActivity.java From ZZShow with Apache License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.KITKAT) protected void setStatusBarTranslucent(){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){ if(!(this instanceof NewsDetailActivity )) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); SystemBarTintManager tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintResource(R.color.colorPrimary); } } }
Example 7
Source File: Utility.java From BlackLight with GNU General Public License v3.0 | 5 votes |
@TargetApi(19) public static void enableTint(Activity activity) { if (Build.VERSION.SDK_INT < 19) return; Window w = activity.getWindow(); WindowManager.LayoutParams p = w.getAttributes(); p.flags |= WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; w.setAttributes(p); SystemBarTintManager m = new SystemBarTintManager(activity); m.setStatusBarTintEnabled(true); m.setStatusBarTintResource(R.color.action_gray); }
Example 8
Source File: MatchActionBarActivity.java From SystemBarTint with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_match_actionbar); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { setTranslucentStatus(true); } SystemBarTintManager tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintResource(R.color.statusbar_bg); }
Example 9
Source File: SwipeBackAppCompatFragmentActivity.java From tup.dota2recipe with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // mHelper = new SwipeBackActivityHelper(this); // mHelper.onActivityCreate(); final SystemBarTintManager tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintResource(R.color.actionbar_bg); if (!Utils.hasSmartBar()) { tintManager.setNavigationBarTintEnabled(true); tintManager.setNavigationBarTintResource(R.color.statusbar_bg); } else { // Meizu 手机 // 设置状态栏图标文字为深色 Utils.setStatusBarDarkIcon(getWindow(), true); // 设置状态栏不透明 Utils.setImmersedWindow(getWindow(), false); final ActionBar bar = this.getSupportActionBar(); // 设置ActionBar顶栏背景 bar.setBackgroundDrawable(this.getResources().getDrawable(R.drawable.ab_solid_tupdota2)); // 设置SmartBar背景 bar.setSplitBackgroundDrawable(this.getResources() .getDrawable(R.drawable.ab_bottom_solid_tupdota2)); } }