开始吧。加载框架,反编systemUI.apk
原理:我们要做的是先找到显示运营商需要的那个Textview的控件。这个控件一般在下拉栏的布局里存在,你可以下拉看看,一般下拉栏有这个。我们就是利用它,把它移到状态栏去。
打开SystemUI\res\layout\status_bar_expanded.xml,这个就是下拉栏的布局文件了,这个是4.2的,4.0的在status_bar_tracking.xml这里。
然后就是找那个Textview了啊。稍稍翻译一下就能找到了,根据id的item name就能分辨出来了,很明显,
在4.2中是这句
01
<include android:layout_gravity="bottom" android:layout_width="fill_parent" android:layout_height="@dimen/carrier_label_height" android:layout_marginBottom="@dimen/close_handle_height" layout="@layout/carrier_label" />
把这句整个拷贝下来移到ststus_bar.xml,当然要选择一个合适的布局的位置去,具体的这里不好说,每个人的布局环境可能不一样。
在4.0中代码是
01. <com.android.systemui.statusbar.phone.CarrierLabel
02. android:textAppearance="@style
03. /TextAppearance.StatusBar.Clock" android:gravity="left|center"
04. android:paddingLeft="6.0dip" android:layout_width="wrap_content"
05. android:layout_height="fill_parent" android:singleLine="true" />
千万注意,别移过去之后就啥都不干了,注意一下属性的修改,比如gravity=""这个自己看,然后
android:layout_width="wrap_content"
android:layout_height="fill_parent"
这两个一定要修改成这样,不然会把别的图标挡掉。
原理:我们要做的是先找到显示运营商需要的那个Textview的控件。这个控件一般在下拉栏的布局里存在,你可以下拉看看,一般下拉栏有这个。我们就是利用它,把它移到状态栏去。
打开SystemUI\res\layout\status_bar_expanded.xml,这个就是下拉栏的布局文件了,这个是4.2的,4.0的在status_bar_tracking.xml这里。
然后就是找那个Textview了啊。稍稍翻译一下就能找到了,根据id的item name就能分辨出来了,很明显,
在4.2中是这句
01
<include android:layout_gravity="bottom" android:layout_width="fill_parent" android:layout_height="@dimen/carrier_label_height" android:layout_marginBottom="@dimen/close_handle_height" layout="@layout/carrier_label" />
把这句整个拷贝下来移到ststus_bar.xml,当然要选择一个合适的布局的位置去,具体的这里不好说,每个人的布局环境可能不一样。
在4.0中代码是
01. <com.android.systemui.statusbar.phone.CarrierLabel
02. android:textAppearance="@style
03. /TextAppearance.StatusBar.Clock" android:gravity="left|center"
04. android:paddingLeft="6.0dip" android:layout_width="wrap_content"
05. android:layout_height="fill_parent" android:singleLine="true" />
千万注意,别移过去之后就啥都不干了,注意一下属性的修改,比如gravity=""这个自己看,然后
android:layout_width="wrap_content"
android:layout_height="fill_parent"
这两个一定要修改成这样,不然会把别的图标挡掉。