小米5s plusplus怎样修改状态栏顶部颜色

经验2753 米
在线时间132 小时
版本7.11.14
机型小米手机5S
签到次数152
MIUI版本7.11.14
用了几年iPhone习惯了触摸状态栏返回顶部,现在又用回安卓里面系统最好用的小米手机,可是很多人性化的功能竟然没有了,譬如长按预览,顶部返回,全局从左到右返回等这些人性化的功能都没有,希望开发组能够重视一些用户体验的功能。谢谢
分享到微信朋友圈
打开微信,点击底部的“发现”,使用 “扫一扫” 即可将网页分享到我的朋友圈。
经验2753 米
在线时间132 小时
版本7.11.14
机型小米手机5S
签到次数152
MIUI版本7.11.14
经验10351 米
在线时间875 小时
版本7.12.7
积分 13001, 距离下一级还需 6999 积分
积分 13001, 距离下一级还需 6999 积分
机型小米手机5S
签到次数99
MIUI版本7.12.7
经验2753 米
在线时间132 小时
版本7.11.14
机型小米手机5S
签到次数152
MIUI版本7.11.14
汛汛仔 发表于
在线时间2 小时
版本V9.5.3.0.OCACNFA
积分 36, 距离下一级还需 14 积分
积分 36, 距离下一级还需 14 积分
机型小米手机6
MIUI版本V9.5.3.0.OCACNFA
miui能不能开发类似的功能呢,还有长按键盘,可以修改光标位置
MIUI 9纪念勋章
“澎湃S1 ”芯片纪念勋章
参与活动回帖可得
小米手机元器件合体活动勋章
小米求合体勋章
Copyright (C) 2017 MIUI
京ICP备号 | 京公网安备34号 | 京ICP证110507号【图片】#小米5SPlus#小米5SPlus 7.0最新开发版Magisk框架黑域个性化设置【小米5splus吧】_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0可签7级以上的吧50个
本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:17,635贴子:
小米5SPlus 7.0最新开发版Magisk框架黑域个性化设置
添加手机性能控制选项,支持三种运行模式:省电模式、标准模式、性能模式支持性能设置,可设置CPU工作模式、最小频率、最大频率支持节电助手,支持性能限制开关、CPU工作核数自定义、GPU频率设置支持节电助手开关,可设置电量剩余多少时进行自动节电支持CPU节电开关屏幕助手添加更多自定义选项,支持长按键位自定义添加来电闪光功能,支持闪光频率自定义添加Magisk框架,类似于Xposed框架,具体情况请百度了解添加黑域,默认已开启服务(每次开机自启动),可在高级设置中关闭采用rawimg压缩格式,彻底解决文件权限、软链接等问题修复init.d脚本自启,可将自己需要开机自启的shell脚本放在/system/etc/init.d目录下新增自启动管理可管理系统应用,移除41个系统应用自启动,降低系统内存占用新增游戏加速界面全新改版,实时显示CPU占用、可用内存、网速延时新增屏幕录制功能,系统级功能,支持手机内外声音录制新增新版网络助手,支持显示话费信息新增应用锁新增消息屏蔽,收到通知时自动屏蔽消息内容,保护隐私更加安全新增小米音乐全新改版,畅爽体验新增图片美化支持文字编辑功能新增高级设置:设置-高级设置添加分辨率切换功能,支持三种分辨率切换(注:分辨率切换会强制修改DPI,修改分辨率后不要使用DPI切换功能)添加状态栏切换:IOS状态栏、IOS状态栏+图标、官方默认状态栏添加状态栏时间风格切换:显示农历/星期/时间添加底部导航栏开关,可在手机底部添加虚拟按键添加DPI设置支持自定义,可自定大小添加动画特效切换,支持IOS特效、MIUI特效切换添加桌面图表布局调整,支持4x5,4x6,5x5,6x6切换新增系统精简功能,支持极限精简、适度精简、自定义精简极限精简删除了较多系统APP,影响一些功能的正常使用适度精简仅删除部分服务功能,基本不影响功能正常使用自定义精简支持用户自主精简,精简完毕后请重启手机使之生效新增屏幕助手新增程序冻结功能,支持系统app&用户app冻结新增CPU设置,支持CPU最大&最小频率调整,CPU工作模式选择新增WIFI密码查看功能新增蝰蛇音效,驱动已集成,NEON已启用新增杜比音效,支持全局杜比音效输出破解系统应用管理器签名验证完美主题破解,永不恢复!添加高级重启至系统重启选项中,支持重启到Rec模式,FastBoot模式开启ROOT权限优化通知栏卡片为直角(原来为圆角)去除通知栏搜索框破解MIUI防删除系统App限制
下载地址:
开发版还是稳定版
稳定版刷这个会不会清空数据
稳定版什么时候
电信卡能使吗?
贴吧热议榜
使用签名档&&
保存至快速回贴小米手机5splus颜色如何调节_百度知道
小米手机5splus颜色如何调节
小米手机5splus颜色如何调节
我有更好的答案
电话本字体无法单独设置,是跟主题设计有关的。
祝您生活愉快!
为您推荐:
其他类似问题
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。留下的东西
修改魅族和小米状态栏的文字颜色
代码如下:在你的BaseActivity或者Activity代码中添加 SystemBarTextColorChange.changeBarTextColor(Activity.this,true);
import android.app.A
import android.content.C
import android.view.W
import android.view.WindowM
import java.lang.reflect.F
import java.lang.reflect.M
* create by Smile_KO on
* use for 修改状态栏文字颜色
public class SystemBarTextColorChange {
public static void changeBarTextColor(Context context, boolean darkmode){
String manufacturer = android.os.Build.MANUFACTURER;
if (manufacturer.equals("Meizu") {
setMeizuStatusBarDarkIcon((Activity) context, darkmode);
} else if (manufacturer.equals("Xiaomi") {
setMiuiStatusBarDarkMode((Activity) context, darkmode);
//修改小米 MIUI
private static boolean setMiuiStatusBarDarkMode(Activity activity, boolean darkmode) {
Class&? extends Window& clazz = activity.getWindow().getClass();
int darkModeFlag = 0;
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);
} catch (Exception e) {
e.printStackTrace();
//修改魅族 Flyme
private static boolean setMeizuStatusBarDarkIcon(Activity activity, boolean dark) {
boolean result =
if (activity != null) {
WindowManager.LayoutParams lp = activity.getWindow().getAttributes();
Field darkFlag = WindowManager.LayoutParams.class
.getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
Field meizuFlags = WindowManager.LayoutParams.class
.getDeclaredField("meizuFlags");
darkFlag.setAccessible(true);
meizuFlags.setAccessible(true);
int bit = darkFlag.getInt(null);
int value = meizuFlags.getInt(lp);
if (dark) {
value &= ~
meizuFlags.setInt(lp, value);
activity.getWindow().setAttributes(lp);
} catch (Exception e) {
e.printStackTrace();
没有更多推荐了,
加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!所有的有人存在的地方都是围城,一群人笑着进去,一群人笑着出来。
沉浸式之改变小米状态栏颜色
这个是基于SystemBarTintManager更改的
增加一个方法:用于更改MIUIV6系统上的状态栏字体颜色 ,目前我仅仅只发现MIUIV6上可以更改,在android5.0上以及其它4.4以上系统没有发现可以更改字体颜色的代码
public void setStatusBarDarkMode(boolean darkmode, Activity activity) {
if (sIsMiuiV6) {
Class&? extends Window& clazz = activity.getWindow().getClass();
int darkModeFlag = 0;
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);
} catch (Exception e) {
e.printStackTrace();
* Copyright (C) 2013 readyState Software Ltd
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
import android.annotation.SuppressL
import android.annotation.TargetA
import android.app.A
import android.content.C
import android.content.res.C
import android.content.res.R
import android.content.res.TypedA
import android.graphics.drawable.D
import android.os.B
import android.util.DisplayM
import android.util.TypedV
import android.view.G
import android.view.V
import android.view.ViewC
import android.view.ViewG
import android.view.W
import android.view.WindowM
import android.widget.FrameLayout.LayoutP
import java.lang.reflect.F
import java.lang.reflect.M
* Class to manage status and navigation bar tint effects when using KitKat
* translucent system UI modes.
public class SystemBarTintManager {
* The default system bar tint color value.
public static final int DEFAULT_TINT_COLOR = 0x;
private static String sNavBarO
private final SystemBarConfig mC
private boolean mStatusBarA
private boolean mNavBarA
private boolean mStatusBarTintE
private boolean mNavBarTintE
private View mStatusBarTintV
private View mNavBarTintV
private static boolean sIsMiuiV6;
// Android allows a system property to override the presence of the navigation bar.
// Used by the emulator.
// See https://github.com/android/platform_frameworks_base/blob/master/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java#L1076
if (Build.VERSION.SDK_INT &= Build.VERSION_CODES.KITKAT) {
Class c = Class.forName("android.os.SystemProperties");
Method m = c.getDeclaredMethod("get", String.class);
m.setAccessible(true);
sIsMiuiV6 = "V6".equals((String) m.invoke(c, "ro.miui.ui.version.name"));
sNavBarOverride = (String) m.invoke(null, "qemu.hw.mainkeys");
} catch (Throwable e) {
sNavBarOverride =
* Constructor. Call this in the host activity onCreate method after its
* content view has been set. You should always create new instances when
* the host activity is recreated.
* @param activity The host activity.
@TargetApi(19)
public SystemBarTintManager(Activity activity) {
Window win = activity.getWindow();
ViewGroup decorViewGroup = (ViewGroup) win.getDecorView();
if (Build.VERSION.SDK_INT &= Build.VERSION_CODES.KITKAT) {
// check theme attrs
int[] attrs = {android.R.attr.windowTranslucentStatus,
android.R.attr.windowTranslucentNavigation};
TypedArray a = activity.obtainStyledAttributes(attrs);
mStatusBarAvailable = a.getBoolean(0, false);
mNavBarAvailable = a.getBoolean(1, false);
} finally {
a.recycle();
// check window flags
WindowManager.LayoutParams winParams = win.getAttributes();
int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
if ((winParams.flags & bits) != 0) {
mStatusBarAvailable =
bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
if ((winParams.flags & bits) != 0) {
mNavBarAvailable =
mConfig = new SystemBarConfig(activity, mStatusBarAvailable, mNavBarAvailable);
// device might not have virtual navigation keys
if (!mConfig.hasNavigtionBar()) {
mNavBarAvailable =
if (mStatusBarAvailable) {
setupStatusBarView(activity, decorViewGroup);
if (mNavBarAvailable) {
setupNavBarView(activity, decorViewGroup);
* Enable tinting of the system status bar.
* If the platform is running Jelly Bean or earlier, or translucent system
* UI modes have not been enabled in either the theme or via window flags,
* then this method does nothing.
* @param enabled True to enable tinting, false to disable it (default).
public void setStatusBarTintEnabled(boolean enabled) {
mStatusBarTintEnabled =
if (mStatusBarAvailable) {
mStatusBarTintView.setVisibility(enabled ? View.VISIBLE : View.GONE);
* Enable tinting of the system navigation bar.
* If the platform does not have soft navigation keys, is running Jelly Bean
* or earlier, or translucent system UI modes have not been enabled in either
* the theme or via window flags, then this method does nothing.
* @param enabled True to enable tinting, false to disable it (default).
public void setNavigationBarTintEnabled(boolean enabled) {
mNavBarTintEnabled =
if (mNavBarAvailable) {
mNavBarTintView.setVisibility(enabled ? View.VISIBLE : View.GONE);
* Apply the specified color tint to all system UI bars.
* @param color The color of the background tint.
public void setTintColor(int color) {
setStatusBarTintColor(color);
setNavigationBarTintColor(color);
* Apply the specified drawable or color resource to all system UI bars.
* @param res The identifier of the resource.
public void setTintResource(int res) {
setStatusBarTintResource(res);
setNavigationBarTintResource(res);
* Apply the specified drawable to all system UI bars.
* @param drawable The drawable to use as the background, or null to remove it.
public void setTintDrawable(Drawable drawable) {
setStatusBarTintDrawable(drawable);
setNavigationBarTintDrawable(drawable);
* Apply the specified alpha to all system UI bars.
* @param alpha The alpha to use
public void setTintAlpha(float alpha) {
setStatusBarAlpha(alpha);
setNavigationBarAlpha(alpha);
* Apply the specified color tint to the system status bar.
* @param color The color of the background tint.
public void setStatusBarTintColor(int color) {
if (mStatusBarAvailable) {
mStatusBarTintView.setBackgroundColor(color);
* Apply the specified drawable or color resource to the system status bar.
* @param res The identifier of the resource.
public void setStatusBarTintResource(int res) {
if (mStatusBarAvailable) {
mStatusBarTintView.setBackgroundResource(res);
* Apply the specified drawable to the system status bar.
* @param drawable The drawable to use as the background, or null to remove it.
@SuppressWarnings("deprecation")
public void setStatusBarTintDrawable(Drawable drawable) {
if (mStatusBarAvailable) {
mStatusBarTintView.setBackgroundDrawable(drawable);
* Apply the specified alpha to the system status bar.
* @param alpha The alpha to use
@TargetApi(11)
public void setStatusBarAlpha(float alpha) {
if (mStatusBarAvailable && Build.VERSION.SDK_INT &= Build.VERSION_CODES.HONEYCOMB) {
mStatusBarTintView.setAlpha(alpha);
* Apply the specified color tint to the system navigation bar.
* @param color The color of the background tint.
public void setNavigationBarTintColor(int color) {
if (mNavBarAvailable) {
mNavBarTintView.setBackgroundColor(color);
* Apply the specified drawable or color resource to the system navigation bar.
* @param res The identifier of the resource.
public void setNavigationBarTintResource(int res) {
if (mNavBarAvailable) {
mNavBarTintView.setBackgroundResource(res);
* Apply the specified drawable to the system navigation bar.
* @param drawable The drawable to use as the background, or null to remove it.
@SuppressWarnings("deprecation")
public void setNavigationBarTintDrawable(Drawable drawable) {
if (mNavBarAvailable) {
mNavBarTintView.setBackgroundDrawable(drawable);
* Apply the specified alpha to the system navigation bar.
* @param alpha The alpha to use
@TargetApi(11)
public void setNavigationBarAlpha(float alpha) {
if (mNavBarAvailable && Build.VERSION.SDK_INT &= Build.VERSION_CODES.HONEYCOMB) {
mNavBarTintView.setAlpha(alpha);
* Get the system bar configuration.
* @return The system bar configuration for the current device configuration.
public SystemBarConfig getConfig() {
* Is tinting enabled for the system status bar?
* @return True if enabled, False otherwise.
public boolean isStatusBarTintEnabled() {
return mStatusBarTintE
* Is tinting enabled for the system navigation bar?
* @return True if enabled, False otherwise.
public boolean isNavBarTintEnabled() {
return mNavBarTintE
private void setupStatusBarView(Context context, ViewGroup decorViewGroup) {
mStatusBarTintView = new View(context);
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, mConfig.getStatusBarHeight());
params.gravity = Gravity.TOP;
if (mNavBarAvailable && !mConfig.isNavigationAtBottom()) {
params.rightMargin = mConfig.getNavigationBarWidth();
mStatusBarTintView.setLayoutParams(params);
mStatusBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR);
mStatusBarTintView.setVisibility(View.GONE);
decorViewGroup.addView(mStatusBarTintView);
private void setupNavBarView(Context context, ViewGroup decorViewGroup) {
mNavBarTintView = new View(context);
if (mConfig.isNavigationAtBottom()) {
params = new LayoutParams(LayoutParams.MATCH_PARENT, mConfig.getNavigationBarHeight());
params.gravity = Gravity.BOTTOM;
params = new LayoutParams(mConfig.getNavigationBarWidth(), LayoutParams.MATCH_PARENT);
params.gravity = Gravity.RIGHT;
mNavBarTintView.setLayoutParams(params);
mNavBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR);
mNavBarTintView.setVisibility(View.GONE);
decorViewGroup.addView(mNavBarTintView);
* Class which describes system bar sizing and other characteristics for the current
* device configuration.
public static class SystemBarConfig {
private static final String STATUS_BAR_HEIGHT_RES_NAME = "status_bar_height";
private static final String NAV_BAR_HEIGHT_RES_NAME = "navigation_bar_height";
private static final String NAV_BAR_HEIGHT_LANDSCAPE_RES_NAME = "navigation_bar_height_landscape";
private static final String NAV_BAR_WIDTH_RES_NAME = "navigation_bar_width";
private static final String SHOW_NAV_BAR_RES_NAME = "config_showNavigationBar";
private final boolean mTranslucentStatusB
private final boolean mTranslucentNavB
private final int mStatusBarH
private final int mActionBarH
private final boolean mHasNavigationB
private final int mNavigationBarH
private final int mNavigationBarW
private final boolean mInP
private final float mSmallestWidthDp;
private SystemBarConfig(Activity activity, boolean translucentStatusBar, boolean traslucentNavBar) {
Resources res = activity.getResources();
mInPortrait = (res.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT);
mSmallestWidthDp = getSmallestWidthDp(activity);
mStatusBarHeight = getInternalDimensionSize(res, STATUS_BAR_HEIGHT_RES_NAME);
mActionBarHeight = getActionBarHeight(activity);
mNavigationBarHeight = getNavigationBarHeight(activity);
mNavigationBarWidth = getNavigationBarWidth(activity);
mHasNavigationBar = (mNavigationBarHeight & 0);
mTranslucentStatusBar = translucentStatusB
mTranslucentNavBar = traslucentNavB
@TargetApi(14)
private int getActionBarHeight(Context context) {
int result = 0;
if (Build.VERSION.SDK_INT &= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
TypedValue tv = new TypedValue();
context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true);
result = TypedValue.complexToDimensionPixelSize(tv.data, context.getResources().getDisplayMetrics());
@TargetApi(14)
private int getNavigationBarHeight(Context context) {
Resources res = context.getResources();
int result = 0;
if (Build.VERSION.SDK_INT &= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
if (hasNavBar(context)) {
if (mInPortrait) {
key = NAV_BAR_HEIGHT_RES_NAME;
key = NAV_BAR_HEIGHT_LANDSCAPE_RES_NAME;
return getInternalDimensionSize(res, key);
@TargetApi(14)
private int getNavigationBarWidth(Context context) {
Resources res = context.getResources();
int result = 0;
if (Build.VERSION.SDK_INT &= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
if (hasNavBar(context)) {
return getInternalDimensionSize(res, NAV_BAR_WIDTH_RES_NAME);
@TargetApi(14)
private boolean hasNavBar(Context context) {
Resources res = context.getResources();
int resourceId = res.getIdentifier(SHOW_NAV_BAR_RES_NAME, "bool", "android");
if (resourceId != 0) {
boolean hasNav = res.getBoolean(resourceId);
// check override flag (see static block)
if ("1".equals(sNavBarOverride)) {
} else if ("0".equals(sNavBarOverride)) {
return hasN
} else { // fallback
return !ViewConfiguration.get(context).hasPermanentMenuKey();
private int getInternalDimensionSize(Resources res, String key) {
int result = 0;
int resourceId = res.getIdentifier(key, "dimen", "android");
if (resourceId & 0) {
result = res.getDimensionPixelSize(resourceId);
@SuppressLint("NewApi")
private float getSmallestWidthDp(Activity activity) {
DisplayMetrics metrics = new DisplayMetrics();
if (Build.VERSION.SDK_INT &= Build.VERSION_CODES.JELLY_BEAN) {
activity.getWindowManager().getDefaultDisplay().getRealMetrics(metrics);
// TODO this is not correct, but we don't really care pre-kitkat
activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
float widthDp = metrics.widthPixels / metrics.
float heightDp = metrics.heightPixels / metrics.
return Math.min(widthDp, heightDp);
* Should a navigation bar appear at the bottom of the screen in the current
* device configuration? A navigation bar may appear on the right side of
* the screen in certain configurations.
* @return True if navigation should appear at the bottom of the screen, False otherwise.
public boolean isNavigationAtBottom() {
return (mSmallestWidthDp &= 600 || mInPortrait);
* Get the height of the system status bar.
* @return The height of the status bar (in pixels).
public int getStatusBarHeight() {
return mStatusBarH
* Get the height of the action bar.
* @return The height of the action bar (in pixels).
public int getActionBarHeight() {
return mActionBarH
* Does this device have a system navigation bar?
* @return True if this device uses soft key navigation, False otherwise.
public boolean hasNavigtionBar() {
return mHasNavigationB
* Get the height of the system navigation bar.
* @return The height of the navigation bar (in pixels). If the device does not have
* soft navigation keys, this will always return 0.
public int getNavigationBarHeight() {
return mNavigationBarH
* Get the width of the system navigation bar when it is placed vertically on the screen.
* @return The width of the navigation bar (in pixels). If the device does not have
* soft navigation keys, this will always return 0.
public int getNavigationBarWidth() {
return mNavigationBarW
* Get the layout inset for any system UI that appears at the top of the screen.
* @param withActionBar True to include the height of the action bar, False otherwise.
* @return The layout inset (in pixels).
public int getPixelInsetTop(boolean withActionBar) {
return (mTranslucentStatusBar ? mStatusBarHeight : 0) + (withActionBar ? mActionBarHeight : 0);
* Get the layout inset for any system UI that appears at the bottom of the screen.
* @return The layout inset (in pixels).
public int getPixelInsetBottom() {
if (mTranslucentNavBar && isNavigationAtBottom()) {
return mNavigationBarH
* Get the layout inset for any system UI that appears at the right of the screen.
* @return The layout inset (in pixels).
public int getPixelInsetRight() {
if (mTranslucentNavBar && !isNavigationAtBottom()) {
return mNavigationBarW
public void setStatusBarDarkMode(boolean darkmode, Activity activity) {
if (sIsMiuiV6) {
Class&? extends Window& clazz = activity.getWindow().getClass();
int darkModeFlag = 0;
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);
} catch (Exception e) {
e.printStackTrace();
public void initSystemBar(){
if (VERSION.SDK_INT &= VERSION_CODES.KITKAT) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
fwRootLayout.setFitsSystemWindows(true);//需要把根布局设置为这个属性 子布局则不会占用状态栏位置
fwRootLayout.setClipToPadding(true);//需要把根布局设置为这个属性 子布局则不会占用状态栏位置
tintManager = new SystemBarTintManager(this);// 创建状态栏的管理实例
tintManager.setStatusBarTintEnabled(true);// 激活状态栏设置
tintManager.setNavigationBarTintEnabled(true);// 激活导航栏设置
tintManager.setStatusBarTintColor(getResources().getColor(R.color.blue500));//设置状态栏颜色
tintManager.setStatusBarDarkMode(false, this);//false 状态栏字体颜色是白色 true 颜色是黑色
没有更多推荐了,
加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!}

我要回帖

更多关于 买小米5splus后悔死了 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信