今天小编为各位带来的是MIUI10状态栏显示已用运存百分比教程,成功后大家就可以在手机的状态栏看到已经使用的运存百分比了。
首先用 MT管理器打开MiuiSystemUI.apk,把https://pan.baidu.com/s/1tW5GgQyTItJl6eo4CrX4xw内的文件解压到MiuiSystemUI.apk里,解压后如图
打开res/layout/system_icons.xml
在里面添加代码<com.cxqd.ui.yun< p="">
android:textAppearance="@style/TextAppearance.StatusBar.Carrier"
android:gravity="center|end"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:singleLine="true" />
相关位置如下
最后保存回去,其实到这里教程就可以算结束了,但是文字并不能随状态栏背景而变色,只有单一的白色,遇到背景也是白色就看不见了,以下是解决这个问题
打开MiuiSystemUI.apk里面的classes.dex,用"Dex编辑器++"方式打开,路径com/android/systemui/statusbar/phone/CollapsedStatusBarFragment
搜索(注意前面有个点)
.field private mStatusClock:Lcom/android/systemui/statusbar/policy/Clock;
在下面添加
.field private yun:Lcom/cxqd/ui/Yun;
如图
再次搜索
iput-object v0, p0, Lcom/android/systemui/statusbar/phone/CollapsedStatusBarFragment;->mStatusClock:Lcom/android/systemui/statusbar/policy/Clock;
在下面添加
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/CollapsedStatusBarFragment;->mStatusBar:Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;
const-string v1, "yun"
invoke-virtual {v0, v1}, Landroid/view/View;->findViewWithTag(Ljava/lang/Object;)Landroid/view/View;
move-result-object v0
check-cast v0, Lcom/cxqd/ui/Yun;
iput-object v0, p0, Lcom/android/systemui/statusbar/phone/CollapsedStatusBarFragment;->yun:Lcom/cxqd/ui/Yun;
如图
再次搜索
invoke-interface {v0, v1}, Lcom/android/systemui/statusbar/policy/DarkIconDispatcher;->addDarkReceiver(Lcom/android/systemui/statusbar/policy/DarkIconDispatcher;)V
在下面添加
const-class v0, Lcom/android/systemui/statusbar/policy/DarkIconDispatcher;
invoke-static {v0}, Lcom/android/systemui/Dependency;->get(Ljava/lang/Class;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/android/systemui/statusbar/policy/DarkIconDispatcher;
iget-object v1, p0, Lcom/android/systemui/statusbar/phone/CollapsedStatusBarFragment;->yun:Lcom/cxqd/ui/Yun;
invoke-interface {v0, v1}, Lcom/android/systemui/statusbar/policy/DarkIconDispatcher;->addDarkReceiver(Lcom/android/systemui/statusbar/policy/DarkIconDispatcher;)V
如图
最后回到教程的第二张图里添加的那段代码改成<com.cxqd.ui.yun< p="">
android:textAppearance="@style/TextAppearance.StatusBar.Carrier"
android:gravity="center|end"
android:tag="yun"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:singleLine="true" />
如图
教程结束