5.代码修改排序的简单讲解
从上往下排序分别对应状态栏显示的从左到右

上图是未修改的MIUI6默认布局代码
下图状态栏所示,其实MIUI6状态栏是分成三部分的,最左边是时间显示区,时间右边是通知图标显示区,最右边是电池,信号,WiFi等一系列图标显示区

首先是最左边的时间代码
com.android.systemui.statusbar.policy.Clock 这段代码是定义状态栏时间显示位置的
如果要把它居中,只需要把它放到下图红框代码的下面,并且加以定义

如下图,

定义后的时间居中代码:
<LinearLayout android:layout_gravity="center" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="fill_parent"> <com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="left|center" android:id="@id/clock" android:paddingLeft="3.0dip" android:paddingRight="3.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" /> </LinearLayout>
讲解:LinearLayout 是个线性布局代码段 必须以下面格式来编写 注意最下面括号里多了个 /
<LinearLayout >
中间代码
</LinearLayout>
android:layout_gravity="center" 这一段定义位置居中
("center"是居中的意思 居左为"left" 居右为"right" 中间靠左为"left|center" 中间靠右为 "right|center")
android:orientation="horizontal" 取向为水平 "horizontal"是水平的意思
下面代码段根据@id 后面的notification_icon_area可以知道是通知图标代码,也就是有QQ消息的时候在状态栏显示的QQ图标

下面代码段是信号 WiFi 电池图标的代码

同理,看@id 后面
"@id/moreIcon" 更多图标的显示区,也就是图标多的时候显示的三个点 ...
"@id/network_speed_view" 网速显示区
"@id/statusIcons" 状态图标显示区,就是闹钟,静音,振动等一系列图标显示区
"@id/signal_cluster_container" 信号图标显示区
"@id/battery" 电池图标显示区
"@id/battery_num" 电量百分比数字显示区
像前面所说的从上往下排序分别对应状态栏显示的从左到右
所以要把电量百分比放到电池图标前面,那么就把"@id/battery_num"这一段落移动到"@id/battery"的上面即可