Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

状态栏为白色的时候能兼容所有手机吗? #4

Closed
AndSync opened this issue May 20, 2017 · 7 comments
Closed

状态栏为白色的时候能兼容所有手机吗? #4

AndSync opened this issue May 20, 2017 · 7 comments

Comments

@AndSync
Copy link

AndSync commented May 20, 2017

目前我们app设计的基本上标题栏都是白色,状态栏做成白色的话 是只有 小米 魅族等个别厂商手机还有android6.0以上的可以将字体改成黑色,其他的怎么办?

@gyf-dev
Copy link
Owner

gyf-dev commented May 20, 2017

不能修改状态栏字体为黑色的,你可以设置状态栏透明度statusBarAlpha(0.2f),好多app都这样处理的,如图效果,
wx20170520-163508 2x

@AndSync
Copy link
Author

AndSync commented May 20, 2017

如何判断支持不支持,然后去设置呢?

@gyf-dev
Copy link
Owner

gyf-dev commented May 20, 2017

if (OSUtils.isMIUI() || OSUtils.isFlymeOS() || Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
      //处理状态栏字体为黑色
  } else {
     //处理状态栏有透明度  
  }

OSUtils这个类也是ImmersionBar库里的

@AndSync
Copy link
Author

AndSync commented May 20, 2017

好吧 这个可不可以暴露个接口啊 不然用起来不太方便,有的页面可能还需要动态的修改颜色 ,还要加各种判断

@gyf-dev
Copy link
Owner

gyf-dev commented May 23, 2017

@AndSync
现在你可以这样判断了

if(ImmersionBar.isSupportStatusBarDarkFont()){
    //处理状态栏字体为黑色
}else {
    //处理状态栏有透明度
}

@AndSync
Copy link
Author

AndSync commented May 25, 2017

4.3以下的 还需要用户自己判断版本号吗?

@gyf-dev
Copy link
Owner

gyf-dev commented May 25, 2017

@AndSync
本来就是不需要的,只是个别机器rom实在坑爹

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants