search

Home  >  Q&A  >  body text

Android状态字体颜色

Android6.0下状态栏字体颜色怎么修改成黑色,我看有的App6.0下也能使用

PHPzPHPz2771 days ago589

reply all(3)I'll reply

  • 大家讲道理

    大家讲道理2017-04-18 09:09:53

    Let’s recommend an article that introduces the status bar in detail. Not all Android systems can modify the status bar to black text on a white background. It depends on whether the system provides an API. Android itself does not support such operations. Domestic Android systems have been customized, and some have open interfaces, such as Xiaomi and Meizu.
    Android status bar operation, everything you want to know is here

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 09:09:53

    http://www.jianshu.com/p/7f5a... Recommend an article

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 09:09:53

    Xiaomi and Meizu have public methods to set the status bar font color.

        public static boolean setMiuiStatusBarDarkMode(Activity activity, boolean darkmode) {
            Class<? extends Window> clazz = activity.getWindow().getClass();
            try {
                int darkModeFlag;
                Class<?> layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams");
                Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE");
                darkModeFlag = field.getInt(layoutParams);
                Method extraFlagField = clazz.getMethod("setExtraFlags", int.class, int.class);
                extraFlagField.invoke(activity.getWindow(), darkmode ? darkModeFlag : 0, darkModeFlag);
                return true;
            } catch (Exception e) {
                e.printStackTrace();
            }
            return false;
        }

    Meizu, uh uh, look for it online, I remember I had it before, but I couldn’t find it for a while.
    PS: Android 6.0 seems to work too.

    reply
    0
  • Cancelreply