XML 101 - XML Modding Made Easy!

Search This thread

Ticklefish

Inactive Recognized Themer
Oct 27, 2011
6,773
8,633
Hampshire, UK
it works!!!!! thanks bro, the only thing is the data icon is showing on right side of signal, next to battery haha, any tip to move it to the right of the signal icon? :fingers-crossed:

So...the data icon is on the right side of the signal and you want to move it to the...right side of the signal? ;)

If you want to move it to the left side of the icon, you just need to change the order of the lines inside that Layout. The line at the top will be displayed first, then the next line down and so on.
 
  • Like
Reactions: deewfrank

deewfrank

Senior Member
Jan 3, 2013
85
12
27
Temuco
So...the data icon is on the right side of the signal and you want to move it to the...right side of the signal? ;)

If you want to move it to the left side of the icon, you just need to change the order of the lines inside that Layout. The line at the top will be displayed first, then the next line down and so on.

thanks so much :victory:
finally... thanks for your help bro :angel:
 
  • Like
Reactions: Ticklefish

deewfrank

Senior Member
Jan 3, 2013
85
12
27
Temuco
now im trying to edit this icons, but cant find any line with "signal" or something.... weird xD
you know what xml manage this icons? thanks <3
qXMq6Gl.png
 

millo1978

Senior Member
Mar 28, 2008
625
436
Milano / Horb am Neckar
Hi :)

I have a problem with hiding a Preference (ListPreference - CheckBoxPreference) line in xml file.

I can't use android:visibility="gone" or "invisible" (it doesn't work)
I can't use android:layout_height="0.0dip" (it doesn't work)
I can't delete this line (crash recompiled app)

There is something other that I can do?
In smali folder there is nothing, so I can't use RemovePreference :(
 

Ticklefish

Inactive Recognized Themer
Oct 27, 2011
6,773
8,633
Hampshire, UK
Hi :)

I have a problem with hiding a Preference (ListPreference - CheckBoxPreference) line in xml file.

I can't use android:visibility="gone" or "invisible" (it doesn't work)
I can't use android:layout_height="0.0dip" (it doesn't work)
I can't delete this line (crash recompiled app)

There is something other that I can do?
In smali folder there is nothing, so I can't use RemovePreference :(

Hmm, what an interesting problem. Can you share the code please? I'll look into it and see what I can work out for you.

Sent from my Sony Xperia XA1 using XDA Labs
 
  • Like
Reactions: millo1978

millo1978

Senior Member
Mar 28, 2008
625
436
Milano / Horb am Neckar
Hmm, what an interesting problem. Can you share the code please? I'll look into it and see what I can work out for you.

https://mega.nz/#!BZhRiTYb!xNwFCM0SoxyTWV_BX5I7b04tpUB4c6hQXK9KKGP3Ghk
Here there are my apk files: kangvip-res and KangVIPTools
These files go to framework folder.

I have problems with KangVIPTools.
Not simple to recompile...
Here I wrote how I made it.

res/xml/notification_settings and notification_settings_multi_sim
Code:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
  xmlns:android="http://schemas.android.com/apk/res/android">
    <PreferenceScreen android:title="@string/statusbar_act_settings" android:key="statusbar_act_settings" android:summary="@string/statusbar_act_settings_summary">
        <intent android:persistent="false" android:action="com.kangvip.tools.StatusbarActSettings" />
    </PreferenceScreen>
  <ListPreference android:entries="@array/battery_icon_setting_entries" android:title="@string/battery_icon_title" android:key="battery_style_setting" android:dialogTitle="@string/battery_icon_title" android:entryValues="@array/battery_icon_setting_values" />
    <ListPreference android:entries="@array/battery_line_height_entries" android:title="@string/battery_line_height" android:key="battery_line_height" android:dialogTitle="@string/battery_line_height" android:entryValues="@array/battery_line_height_values" />
    <ListPreference android:entries="@array/entries_status_bar_traffic_style" android:title="@string/show_network_speed_title" android:key="status_bar_traffic_style" android:defaultValue="0" android:dialogTitle="@string/show_network_speed_title" android:entryValues="@array/values_status_bar_traffic_style" />
    <ListPreference android:entries="@array/entries_status_bar_icon_max" android:title="@string/status_bar_icon_max" android:key="status_bar_icon_max" android:defaultValue="5" android:dialogTitle="@string/status_bar_icon_max" android:entryValues="@array/values_status_bar_icon_max" />
    <ListPreference android:entries="@array/entries_k_temperature" android:title="@string/k_temperature" android:key="k_temperature_settings" android:defaultValue="0" android:dialogTitle="@string/k_temperature" android:entryValues="@array/values_k_temperature" />
    <ListPreference android:entries="@array/entries_status_bar_toolbox_mode" android:title="@string/status_bar_toolbox_mode" android:key="k_statusbar_toolbox_mode" android:defaultValue="0" android:dialogTitle="@string/statusbar_toolbox_mode_list" android:entryValues="@array/values_status_bar_toolbox_mode" />
    <ListPreference android:entries="@array/status_bar_signal_cluster_entries" android:title="@string/status_bar_signal_cluster" android:key="signal_cluster_style_setting" android:defaultValue="0" android:dialogTitle="@string/status_bar_signal_cluster" android:entryValues="@array/status_bar_signal_cluster_values" />
    <ListPreference android:entries="@array/status_bar_clock_style_entries" android:title="@string/status_bar_clock_style_title" android:key="status_bar_clock_style" android:dialogTitle="@string/status_bar_clock_style_title" android:entryValues="@array/status_bar_clock_style_values" />
    <ListPreference android:entries="@array/status_bar_time_week" android:title="@string/status_bar_time_week" android:key="status_bar_time_week" android:entryValues="@array/status_bar_time_week_values" />
    <CheckBoxPreference android:title="@string/status_bar_time_second" android:key="status_bar_time_second" android:defaultValue="true" android:summaryOn="@string/checkbox_on" android:summaryOff="@string/checkbox_off" />
    <ListPreference android:entries="@array/entries_ccl_style_multi_sim" android:title="@string/status_bar_carrier_label" android:key="custom_carrier_label" android:defaultValue="0" android:dialogTitle="@string/status_bar_carrier_label" android:entryValues="@array/values_ccl_style_multi_sim" />
    <PreferenceScreen android:title="@string/custom_carrier_label_one" android:key="custom_carrier_label_one" android:summary="@string/custom_carrier_label_summary" />
    <PreferenceScreen android:title="@string/custom_carrier_label_two" android:key="custom_carrier_label_two" android:summary="@string/custom_carrier_label_summary" />
[COLOR="Red"]    <ListPreference android:entries="@array/timedetail_entries" android:title="@string/timedetail_title" android:key="status_bar_time_detail" android:entryValues="@array/timedetail_entries_values" />
    <CheckBoxPreference android:title="@string/switch_signal_wifi_icon" android:key="switch_signal_wifi_icon" android:defaultValue="false" android:summaryOn="@string/checkbox_on" android:summaryOff="@string/checkbox_off" />
    <CheckBoxPreference android:title="@string/statusbar_show_lunar" android:key="statusbar_show_lunar" android:defaultValue="true" android:summaryOn="@string/checkbox_on" android:summaryOff="@string/checkbox_off" />[/COLOR]
</PreferenceScreen>
at the end I have ListPreference and 2 CheckBoxPreference that I want to hide...
but I'm not able to do this :(
Maybe there is something in source code that I don't have.
In smali folder there is nothing.
 
Last edited:

Ticklefish

Inactive Recognized Themer
Oct 27, 2011
6,773
8,633
Hampshire, UK
https://mega.nz/#!BZhRiTYb!xNwFCM0SoxyTWV_BX5I7b04tpUB4c6hQXK9KKGP3Ghk
Here there are my apk files: kangvip-res and KangVIPTools
These files go to framework folder.

I have problems with KangVIPTools.
Not simple to recompile...
Here I wrote how I made it.

res/xml/notification_settings and notification_settings_multi_sim

at the end I have ListPreference and 2 CheckBoxPreference that I want to hide...
but I'm not able to do this :(
Maybe there is something in source code that I don't have.
In smali folder there is nothing.

I haven't done much with Preferences in XML so I don't know the answer. So I had to do some research.

Changing the visibility, layout_width and layout_height only works on what Google describe as 'Views'. Preferences aren't Views, so those attributes are completely ignored.
Preferences do have their own unique attributes but there doesn't seem to be any specifically to change whether they're visible or not.
It's worth adding the attribute "android:enabled="false"" to the lines. This might stop the Preferences from showing...or it might not.

If that doesn't work, it's worth deleting each Preference line individually and seeing if they all cause a FC or if it's just one of them. Failing that you may have to track down the relevant bit of smali and edit that.
That's a bit more involved as you'll have to find the hex reference for the android:key from each line, then find where that reference is used in the smali. It's theoretically possible though.

Sorry it's not a definite answer but I'm pretty sure we can work this out!

Sent from my Sony Xperia XA1 using XDA Labs
 
  • Like
Reactions: millo1978

millo1978

Senior Member
Mar 28, 2008
625
436
Milano / Horb am Neckar
...
It's worth adding the attribute "android:enabled="false"" to the lines. This might stop the Preferences from showing...or it might not.
...

I tested it...
The lines are now in gray...
Not the Solution (hide) ...but good! :)

I can't delete these lines... always FC.
I deleted one line at a time... all these 3 lines get FC.

But I'm happy with gray (unselectable) solution.

Test go on :D
 

Attachments

  • Screenshot_2017-07-06-11-06-55.png
    Screenshot_2017-07-06-11-06-55.png
    118.7 KB · Views: 61
Last edited:

millo1978

Senior Member
Mar 28, 2008
625
436
Milano / Horb am Neckar
I solved with a magic :D

Code:
...
   [COLOR="Red"] <PreferenceScreen [B]android:enabled="false"[/B] [B]android:title=""[/B] [B]android:summary=""[/B]>[/COLOR]
	<ListPreference android:enabled="false" android:entries="@array/timedetail_entries" android:title="@string/timedetail_title" android:key="status_bar_time_detail" android:entryValues="@array/timedetail_entries_values" />
	<CheckBoxPreference android:enabled="false" android:title="@string/switch_signal_wifi_icon" android:key="switch_signal_wifi_icon" android:defaultValue="false" android:summaryOn="@string/checkbox_on" android:summaryOff="@string/checkbox_off" />
	<CheckBoxPreference android:enabled="false" android:title="@string/statusbar_show_lunar" android:key="statusbar_show_lunar" android:defaultValue="true" android:summaryOn="@string/checkbox_on" android:summaryOff="@string/checkbox_off" />
    [COLOR="Red"]</PreferenceScreen>[/COLOR]
...
3 lines in one :D

With no title and summary ("") ... all blank ... unselectable :)

It isn't the Solution, but an acceptable solution.

We hide the dust under the carpet :D
 

Attachments

  • Screenshot_2017-07-06-17-21-10.png
    Screenshot_2017-07-06-17-21-10.png
    118.4 KB · Views: 313
  • Like
Reactions: Ticklefish

Ticklefish

Inactive Recognized Themer
Oct 27, 2011
6,773
8,633
Hampshire, UK
I solved with a magic :D


3 lines in one :D

With no title and summary ("") ... all blank ... unselectable :)

It isn't the Solution, but an acceptable solution.

We hide the dust under the carpet :D

Hey, as long as it works, that's all that matters. :)

Pretty awesome stuff, thanks

I know you're only saying that so you could get over 10 posts then make a post advertising your app...but I appreciate it anyway. :D

Sent from my Sony Xperia XA1 using XDA Labs
 
  • Like
Reactions: millo1978
hey, i stumbled upon this post in hopes someone can help me. im running a custom firmware on my galaxy note 5 (N920P) and with this custom rom the data icons are incorrect and i wanna change them to the respective icons or even a different data icon. clearly i cant change the files because theyre in a .spr fomat. so im guessing there is something in an xml file that can help me with this. so can anyone assist me?
 

Ticklefish

Inactive Recognized Themer
Oct 27, 2011
6,773
8,633
Hampshire, UK
hey, i stumbled upon this post in hopes someone can help me. im running a custom firmware on my galaxy note 5 (N920P) and with this custom rom the data icons are incorrect and i wanna change them to the respective icons or even a different data icon. clearly i cant change the files because theyre in a .spr fomat. so im guessing there is something in an xml file that can help me with this. so can anyone assist me?

I did a little bit of research on this. The only decent mention of SPR files I could find said that Half-Life used them for sprites. Which makes sense for an image file although why somebody would use them in a rom I've no idea..

You could try downloading a utility to modify them but I personally suggest just deleting them and replacing them with PNG files with the same filename. In theory that should work but it's worth backing up your rom first just in case.

Sent from my Sony Xperia XA1 using XDA Labs
 
I did a little bit of research on this. The only decent mention of SPR files I could find said that Half-Life used them for sprites. Which makes sense for an image file although why somebody would use them in a rom I've no idea..

You could try downloading a utility to modify them but I personally suggest just deleting them and replacing them with PNG files with the same filename. In theory that should work but it's worth backing up your rom first just in case.

Sent from my Sony Xperia XA1 using XDA Labs

so which xml file is responsible for showing the data icon
 
Last edited:
I've no idea, I don't have your rom. It's probably in signal_cluster.xml.

That usually shows the icon but, if you want to change what the icon looks like, you'll need to change the actual icon file.

Sent from my Sony Xperia XA1 using XDA Labs

i want to change it to a different icon thats already in SystemUI.apk. the data icons are in res/drawable but they're in.spr so if i go into signal_cluster.xml what line would i change to show an icon thats in res/drawlable?
 

Ticklefish

Inactive Recognized Themer
Oct 27, 2011
6,773
8,633
Hampshire, UK
i want to change it to a different icon thats already in SystemUI.apk. the data icons are in res/drawable but they're in.spr so if i go into signal_cluster.xml what line would i change to show an icon thats in res/drawlable?
You could try downloading a utility to modify them but I personally suggest just deleting them and replacing them with PNG files with the same filename. In theory that should work but it's worth backing up your rom first just in case.

;)

Sent from my Sony Xperia XA1 using XDA Labs
 

Droidphilev

Senior Member
Hello,

XDA search is down for me so don't kill me for asking :(

I'm looking for an easy way to add custom text centered on the statusbar in a Nougat rom.

I added:

<TextView android:textSize="14.0dip" android:textColor="#ffffffff" android:gravity="left|center" android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="@string/hello" android:singleLine="true" />

in systemui/res/layout/status_bar.xml

and:

<string name="hello">Logan</string>

in res/values/string

This works but whatever i do i can't get it in the center. I tried comparing with thet tutorials here but wans't able to get it done. I tried changing 'gravity' from 'left|center' to 'center' but also then it doesn't goto center.

Is there anyone so kind to help me?

Phil
 

Ticklefish

Inactive Recognized Themer
Oct 27, 2011
6,773
8,633
Hampshire, UK
Hello,

XDA search is down for me so don't kill me for asking :(

I'm looking for an easy way to add custom text centered on the statusbar in a Nougat rom.

I added:

<TextView android:textSize="14.0dip" android:textColor="#ffffffff" android:gravity="left|center" android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="@string/hello" android:singleLine="true" />

in systemui/res/layout/status_bar.xml

and:

<string name="hello">Logan</string>

in res/values/string

This works but whatever i do i can't get it in the center. I tried comparing with thet tutorials here but wans't able to get it done. I tried changing 'gravity' from 'left|center' to 'center' but also then it doesn't goto center.

Is there anyone so kind to help me?

Phil

Hmm. You could try using the Simple Method from my post about centering the clock. This will put the string outside the status bar so you can center it on the screen, without having to worry about affecting anything else in the statusbar.

Sent from my Sony Xperia XA1 using XDA Labs
 

Droidphilev

Senior Member
Hello again,

Hmm. You could try using the Simple Method from my post about centering the clock. This will put the string outside the status bar so you can center it on the screen, without having to worry about affecting anything else in the statusbar.

Sent from my Sony Xperia XA1 using XDA Labs

Here is my default status_bar.xml:

Code:
<?xml version="1.0" encoding="utf-8"?>
<com.android.systemui.statusbar.phone.PhoneStatusBarView android:orientation="vertical" android:id="@id/status_bar" android:background="@drawable/system_bar_background" android:focusable="false" android:descendantFocusability="afterDescendants"
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
    <ImageView android:id="@id/notification_lights_out" android:paddingBottom="2.0dip" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:paddingStart="6.0dip" />
    <LinearLayout android:orientation="horizontal" android:id="@id/status_bar_contents" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingStart="6.0dip" android:paddingEnd="8.0dip">
        <com.android.systemui.statusbar.AlphaOptimizedFrameLayout android:orientation="horizontal" android:id="@id/notification_icon_area" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0" />
        <com.android.keyguard.AlphaOptimizedLinearLayout android:orientation="horizontal" android:id="@id/system_icon_area" android:layout_width="wrap_content" android:layout_height="fill_parent">
            <include layout="@layout/system_icons" />
            <TextView android:textSize="@dimen/battery_level_text_size" android:textColor="#ffffffff" android:layout_gravity="center_vertical" android:id="@id/battery_level" android:layout_width="wrap_content" android:layout_height="wrap_content" android:importantForAccessibility="noHideDescendants" android:paddingEnd="@dimen/battery_level_padding_end" android:layout_marginStart="@dimen/header_battery_margin_keyguard" />
            <com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="start|center" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:paddingStart="@dimen/status_bar_clock_starting_padding" android:paddingEnd="@dimen/status_bar_clock_end_padding" />
        </com.android.keyguard.AlphaOptimizedLinearLayout>
    </LinearLayout>
</com.android.systemui.statusbar.phone.PhoneStatusBarView>

I tried to disbale the clock and put some custom text in center of the bar but everything i tried failed.
 
Last edited:
  • Like
Reactions: Ticklefish

Top Liked Posts

  • There are no posts matching your filters.
  • 78

    If you're modding Android, eventually you're going to have to edit some XML.

    Want to center the clock in your statusbar? Rearrange the icons in your navbar? Change the layout of your notification screen? Get rid of a carrier label? Change the colour of some text?

    Then you need to edit some XML files.

    And you might not have any idea how...

    Well, don't worry. The purpose of this thread is to show you just easy XML-editing can be. Once you've read it, you'll be one step closer to being an XML expert!

    This guide is meant for noobs, experienced modders and everyone in between. Hopefully everybody can learn something..

    Here's what this thread has to offer so far:
    - Introduction (This Post)

    - How To Delete A Line (Yes, Really) - http://xdaforums.com/showpost.php?p=56522113&postcount=2

    - Some Useful Codes To Know - http://xdaforums.com/showpost.php?p=56522122&postcount=3

    - How To Change The Colour Of The Status Bar Clock - http://xdaforums.com/showpost.php?p=56522123&postcount=4

    - How To Put An Invisible Softkey In The Status Bar - http://xdaforums.com/showpost.php?p=56522135&postcount=5

    - How To Center The Clock In The Status Bar...Part 1 - http://xdaforums.com/showpost.php?p=56522157&postcount=6

    - How To Center The Clock In The Status Bar...Part 2 - http://xdaforums.com/showpost.php?p=56522168&postcount=7

    - Centering The Clock In Xperia KitKat - http://xdaforums.com/showpost.php?p=59569708&postcount=297

    - android:layout_gravity, android:gravity AND android:layout_weight - http://xdaforums.com/showpost.php?p=56522180&postcount=8

    - Do NOT Edit "public.xml"!! - http://xdaforums.com/showpost.php?p=56522194&postcount=9

    I also encourage others to post guides as well:
    - How To Remove "am/pm" From The Clock On Pre-4.2 Roms (by @KronicSkillz) - http://xdaforums.com/showpost.php?p=56624586&postcount=17

    - How To Swap The Notification And Status Bar Icons (by @Anmol0022) - http://xdaforums.com/showpost.php?p=57959079&postcount=115

    - How To Hide A Centered Status Bar Clock When A Lollipop Device Is Locked (by @S0bes) - http://xdaforums.com/showpost.php?p=58460343&postcount=172
    There will be more coming soon!!


    *** What Is XML? ***

    'XML' stands for 'eXtensible Markup Language'. But you don't need to know that.

    What you need to know is that XML is used by Google to define the layout of Android applications.

    Look at your statusbar. It's Java that controls how your statusbar works, but it's XML that controls where everything on it is.

    (If you want to edit the Java, you can try building the app from source. Or look at editing smali. Smali is harder to understand than XML but there's a great guide by @Goldie here: http://xdaforums.com/galaxy-s2/development-derivatives/guide-understanding-creating-smali-mods-t2488033)

    *** Where Can I Find An App's XML? ***

    To edit an app's XML, you first need to be able to access it. To do that, you need to decompile the .apk file. If you don't decompile, any XML you try editing won't work.

    There are enough tutorials on xda to tell you how to do this that I don't need to fill up space here telling you about it.
    But I always recommend using Tickle My Android (http://xdaforums.com/showthread.php?t=1633333) for any decompiling and recompiling.

    *** What Does XML Look Like? ***

    This is the line of XML that displays the clock on my phone's statusbar:

    Code:
    <com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="start|center" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:paddingStart="6.0dip" />

    One of the great things about XML is that it ignores whitespace. Or, in other words, we can do stuff like this:

    Code:
    <com.android.systemui.statusbar.policy.Clock
        android:textAppearance="@style/TextAppearance.StatusBar.Clock"
        android:gravity="start|center"
        android:id="@id/clock"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:singleLine="true"
        android:paddingStart="6.0dip"
     />

    Looks a bit more sensible, doesn't it? In theory, you can do this to every single line in a XML file but that'd be time-consuming and a bit pointless.

    XML consists of two parts: 'tags' and 'attributes'. Google also like to talk about 'Views' and 'ViewGroups', but we won't worry about that for now.

    Essentially, a tag is something you see (even if it's invisible) and an attribute affects the way that tag works. Let's look at that code again with the tags and attributes highlighted..

    Code:
    [color="red"]<com.android.systemui.statusbar.policy.Clock
    [color="blue"]    android:textAppearance="@style/TextAppearance.StatusBar.Clock"
        android:gravity="start|center"
        android:id="@id/clock"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:singleLine="true"
        android:paddingStart="6.0dip"[/color]
     />[/color]

    Hopefully that code is starting to make a bit more sense. If not, don't worry. The more you edit XML, the more you'll understand it.

    We can change those attributes, remove some and add others. And at the end of it all, that clock can look completely different.

    And that's before we start moving the line to somewhere else in the XML file and adding other tags. With a little work, and a little patience, we can make a massive difference to our Android device.

    *** What Do I Need To Know To Start Modding XML Myself? ***

    This is the 'status_bar.xml' from my rom. I have an Xperia Z, runnning stock Sony-themed KitKat, modified by myself and this XML file can be found in 'system/priv-app/SystemUI.apk'.

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <com.android.systemui.statusbar.phone.PhoneStatusBarView android:orientation="vertical" android:id="@id/status_bar" android:background="@drawable/system_bar_background" android:focusable="true" android:fitsSystemWindows="true" android:descendantFocusability="afterDescendants"
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
        <FrameLayout android:id="@id/ongoing_call_bg_parent_layout" android:background="@color/ongoing_call_bg_color" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent">
            <ImageView android:layout_gravity="left" android:id="@id/ongoing_call_glow" android:layout_width="wrap_content" android:layout_height="wrap_content" />
        </FrameLayout>
        <ImageView android:id="@id/notification_lights_out" android:paddingBottom="2.0dip" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:paddingStart="6.0dip" />
        <com.sonymobile.systemui.statusbar.operator.OperatorLabel android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:ellipsize="marquee" android:gravity="start|center" android:id="@id/operator" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:paddingStart="6.0dip" android:paddingEnd="4.0dip" />
        <LinearLayout android:orientation="horizontal" android:id="@id/status_bar_contents" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingStart="6.0dip" android:paddingEnd="6.0dip">
            <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent">
                <com.panel.Button android:id="@id/button" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentStart="true" />
                <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentStart="true">
                    <com.android.systemui.statusbar.StatusBarIconView android:id="@id/moreIcon" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/stat_notify_more" />
                    <com.android.systemui.statusbar.phone.IconPartitioner android:id="@id/notification_icon_area" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
                        <com.android.systemui.statusbar.phone.IconMerger android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/notificationIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentStart="true" />
                        <LinearLayout android:orientation="horizontal" android:id="@id/system_icon_area" android:layout_width="wrap_content" android:layout_height="fill_parent">
                            <com.panel.Panel android:id="@id/panel" android:layout_width="wrap_content" android:layout_height="fill_parent">
                                <LinearLayout android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="fill_parent" />
                                <LinearLayout android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="fill_parent">
                                    <com.android.systemui.statusbar.policy.Traffic android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="start|center" android:id="@id/traffic" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
                                </LinearLayout>
                            </com.panel.Panel>
                            <LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" />
                        </LinearLayout>
                    </com.android.systemui.statusbar.phone.IconPartitioner>
                    <LinearLayout android:gravity="center" android:orientation="horizontal" android:id="@id/signal_battery_cluster" android:layout_width="wrap_content" android:layout_height="fill_parent" android:paddingStart="2.0dip">
                        <include android:id="@id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/signal_cluster_view" />
                        <LinearLayout android:id="@id/battery" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginStart="4.0dip">
                            <ImageView android:layout_gravity="center_vertical" android:id="@id/status" android:layout_width="wrap_content" android:layout_height="wrap_content" />
                            <com.erryy.BatteryText android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="start|center" android:layout_width="wrap_content" android:layout_height="fill_parent" android:paddingStart="1.0dip" />
                            <LinearLayout android:id="@id/battery_meter" android:layout_width="0.0dip" android:layout_height="0.0dip">
                                <ImageView android:layout_gravity="center_vertical" android:id="@id/battery_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" />
                                <ImageView android:layout_gravity="center_vertical" android:id="@id/stamina_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/somc_sys_powersaver" />
                            </LinearLayout>
                            <FrameLayout android:id="@id/battery_percent" android:layout_width="wrap_content" android:layout_height="fill_parent">
                                <com.sonymobile.systemui.statusbar.BatteryImage android:layout_gravity="start|center" android:id="@id/battery_percent_bg" android:layout_width="wrap_content" android:layout_height="wrap_content" />
                            </FrameLayout>
                        </LinearLayout>
                    </LinearLayout>
                    <com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="start|center" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:paddingStart="6.0dip" />
                </LinearLayout>
            </RelativeLayout>
        </LinearLayout>
        <LinearLayout android:orientation="horizontal" android:id="@id/ticker" android:animationCache="false" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingStart="6.0dip">
            <ImageSwitcher android:id="@id/tickerIcon" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:layout_marginEnd="4.0dip">
                <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="center" />
                <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="center" />
            </ImageSwitcher>
            <com.android.systemui.statusbar.phone.TickerView android:id="@id/tickerText" android:paddingTop="2.0dip" android:layout_width="0.0dip" android:layout_height="wrap_content" android:layout_weight="1.0" android:paddingEnd="10.0dip">
                <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" android:textAlignment="viewStart" />
                <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" android:textAlignment="viewStart" />
            </com.android.systemui.statusbar.phone.TickerView>
        </LinearLayout>
        <ImageView android:layout_gravity="top|left|center" android:id="@id/rounded_corner_ul" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/rounded_corner_ul" />
        <ImageView android:layout_gravity="top|right|center" android:id="@id/rounded_corner_ur" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/rounded_corner_ur" />
    </com.android.systemui.statusbar.phone.PhoneStatusBarView>

    If you understand every single line, tag and attribute then you can skip the next three posts. You're clearly an expert and I should probably be calling you 'Sir'... ;)

    If you don't, then read on. Hopefully you can see that, even though there's a lot of code there, it's all just tags and attributes. That's all that XML is. It's easier than it looks.

    I have a few more things to tell you, then I'll show you a few example mods. Then it'd be time for you to practice editing XML for yourself. :D
    45
    *** How To Delete A Line (Yes, Really) ***

    That's right.

    I'm dedicating an entire post to teach you how to use the DELETE button.

    I'm nuts, right?

    Actually...no. (Although my therapist would disagree!)

    Let's have a look at that status_bar.xml again:

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <com.android.systemui.statusbar.phone.PhoneStatusBarView android:orientation="vertical" android:id="@id/status_bar" android:background="@drawable/system_bar_background" android:focusable="true" android:fitsSystemWindows="true" android:descendantFocusability="afterDescendants"
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
        <FrameLayout android:id="@id/ongoing_call_bg_parent_layout" android:background="@color/ongoing_call_bg_color" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent">
            <ImageView android:layout_gravity="left" android:id="@id/ongoing_call_glow" android:layout_width="wrap_content" android:layout_height="wrap_content" />
        </FrameLayout>
        <ImageView android:id="@id/notification_lights_out" android:paddingBottom="2.0dip" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:paddingStart="6.0dip" />
        <com.sonymobile.systemui.statusbar.operator.OperatorLabel android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:ellipsize="marquee" android:gravity="start|center" android:id="@id/operator" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:paddingStart="6.0dip" android:paddingEnd="4.0dip" />
        <LinearLayout android:orientation="horizontal" android:id="@id/status_bar_contents" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingStart="6.0dip" android:paddingEnd="6.0dip">
            <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent">
                <com.panel.Button android:id="@id/button" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentStart="true" />
                <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentStart="true">
                    <com.android.systemui.statusbar.StatusBarIconView android:id="@id/moreIcon" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/stat_notify_more" />
                    <com.android.systemui.statusbar.phone.IconPartitioner android:id="@id/notification_icon_area" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
                        <com.android.systemui.statusbar.phone.IconMerger android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/notificationIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentStart="true" />
                        <LinearLayout android:orientation="horizontal" android:id="@id/system_icon_area" android:layout_width="wrap_content" android:layout_height="fill_parent">
                            <com.panel.Panel android:id="@id/panel" android:layout_width="wrap_content" android:layout_height="fill_parent">
                                <LinearLayout android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="fill_parent" />
                                <LinearLayout android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="fill_parent">
                                    <com.android.systemui.statusbar.policy.Traffic android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="start|center" android:id="@id/traffic" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
                                </LinearLayout>
                            </com.panel.Panel>
                            <LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" />
                        </LinearLayout>
                    </com.android.systemui.statusbar.phone.IconPartitioner>
                    <LinearLayout android:gravity="center" android:orientation="horizontal" android:id="@id/signal_battery_cluster" android:layout_width="wrap_content" android:layout_height="fill_parent" android:paddingStart="2.0dip">
                        <include android:id="@id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/signal_cluster_view" />
                        <LinearLayout android:id="@id/battery" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginStart="4.0dip">
    [COLOR="Red"]                        <ImageView android:layout_gravity="center_vertical" android:id="@id/status" android:layout_width="wrap_content" android:layout_height="wrap_content" />[/color]
                            <com.erryy.BatteryText android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="start|center" android:layout_width="wrap_content" android:layout_height="fill_parent" android:paddingStart="1.0dip" />
                            <LinearLayout android:id="@id/battery_meter" android:layout_width="0.0dip" android:layout_height="0.0dip">
                                <ImageView android:layout_gravity="center_vertical" android:id="@id/battery_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" />
                                <ImageView android:layout_gravity="center_vertical" android:id="@id/stamina_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/somc_sys_powersaver" />
                            </LinearLayout>
                            <FrameLayout android:id="@id/battery_percent" android:layout_width="wrap_content" android:layout_height="fill_parent">
                                <com.sonymobile.systemui.statusbar.BatteryImage android:layout_gravity="start|center" android:id="@id/battery_percent_bg" android:layout_width="wrap_content" android:layout_height="wrap_content" />
                            </FrameLayout>
                        </LinearLayout>
                    </LinearLayout>
                    <com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="start|center" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:paddingStart="6.0dip" />
                </LinearLayout>
            </RelativeLayout>
        </LinearLayout>
        <LinearLayout android:orientation="horizontal" android:id="@id/ticker" android:animationCache="false" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingStart="6.0dip">
            <ImageSwitcher android:id="@id/tickerIcon" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:layout_marginEnd="4.0dip">
                <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="center" />
                <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="center" />
            </ImageSwitcher>
            <com.android.systemui.statusbar.phone.TickerView android:id="@id/tickerText" android:paddingTop="2.0dip" android:layout_width="0.0dip" android:layout_height="wrap_content" android:layout_weight="1.0" android:paddingEnd="10.0dip">
                <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" android:textAlignment="viewStart" />
                <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" android:textAlignment="viewStart" />
            </com.android.systemui.statusbar.phone.TickerView>
        </LinearLayout>
        <ImageView android:layout_gravity="top|left|center" android:id="@id/rounded_corner_ul" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/rounded_corner_ul" />
        <ImageView android:layout_gravity="top|right|center" android:id="@id/rounded_corner_ur" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/rounded_corner_ur" />
    </com.android.systemui.statusbar.phone.PhoneStatusBarView>

    This is the XML that defines the layout of my phone's statusbar. Let's say that I wanted to stop the status icons from showing. That's the line in red above.

    I'd just delete it right?

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <com.android.systemui.statusbar.phone.PhoneStatusBarView android:orientation="vertical" android:id="@id/status_bar" android:background="@drawable/system_bar_background" android:focusable="true" android:fitsSystemWindows="true" android:descendantFocusability="afterDescendants"
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
        <FrameLayout android:id="@id/ongoing_call_bg_parent_layout" android:background="@color/ongoing_call_bg_color" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent">
            <ImageView android:layout_gravity="left" android:id="@id/ongoing_call_glow" android:layout_width="wrap_content" android:layout_height="wrap_content" />
        </FrameLayout>
        <ImageView android:id="@id/notification_lights_out" android:paddingBottom="2.0dip" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:paddingStart="6.0dip" />
        <com.sonymobile.systemui.statusbar.operator.OperatorLabel android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:ellipsize="marquee" android:gravity="start|center" android:id="@id/operator" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:paddingStart="6.0dip" android:paddingEnd="4.0dip" />
        <LinearLayout android:orientation="horizontal" android:id="@id/status_bar_contents" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingStart="6.0dip" android:paddingEnd="6.0dip">
            <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent">
                <com.panel.Button android:id="@id/button" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentStart="true" />
                <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentStart="true">
                    <com.android.systemui.statusbar.StatusBarIconView android:id="@id/moreIcon" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/stat_notify_more" />
                    <com.android.systemui.statusbar.phone.IconPartitioner android:id="@id/notification_icon_area" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
                        <com.android.systemui.statusbar.phone.IconMerger android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/notificationIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentStart="true" />
                        <LinearLayout android:orientation="horizontal" android:id="@id/system_icon_area" android:layout_width="wrap_content" android:layout_height="fill_parent">
                            <com.panel.Panel android:id="@id/panel" android:layout_width="wrap_content" android:layout_height="fill_parent">
                                <LinearLayout android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="fill_parent" />
                                <LinearLayout android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="fill_parent">
                                    <com.android.systemui.statusbar.policy.Traffic android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="start|center" android:id="@id/traffic" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
                                </LinearLayout>
                            </com.panel.Panel>
                            <LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" />
                        </LinearLayout>
                    </com.android.systemui.statusbar.phone.IconPartitioner>
                    <LinearLayout android:gravity="center" android:orientation="horizontal" android:id="@id/signal_battery_cluster" android:layout_width="wrap_content" android:layout_height="fill_parent" android:paddingStart="2.0dip">
                        <include android:id="@id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/signal_cluster_view" />
                        <LinearLayout android:id="@id/battery" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginStart="4.0dip">
                            <com.erryy.BatteryText android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="start|center" android:layout_width="wrap_content" android:layout_height="fill_parent" android:paddingStart="1.0dip" />
                            <LinearLayout android:id="@id/battery_meter" android:layout_width="0.0dip" android:layout_height="0.0dip">
                                <ImageView android:layout_gravity="center_vertical" android:id="@id/battery_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" />
                                <ImageView android:layout_gravity="center_vertical" android:id="@id/stamina_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/somc_sys_powersaver" />
                            </LinearLayout>
                            <FrameLayout android:id="@id/battery_percent" android:layout_width="wrap_content" android:layout_height="fill_parent">
                                <com.sonymobile.systemui.statusbar.BatteryImage android:layout_gravity="start|center" android:id="@id/battery_percent_bg" android:layout_width="wrap_content" android:layout_height="wrap_content" />
                            </FrameLayout>
                        </LinearLayout>
                    </LinearLayout>
                    <com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="start|center" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:paddingStart="6.0dip" />
                </LinearLayout>
            </RelativeLayout>
        </LinearLayout>
        <LinearLayout android:orientation="horizontal" android:id="@id/ticker" android:animationCache="false" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingStart="6.0dip">
            <ImageSwitcher android:id="@id/tickerIcon" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:layout_marginEnd="4.0dip">
                <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="center" />
                <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="center" />
            </ImageSwitcher>
            <com.android.systemui.statusbar.phone.TickerView android:id="@id/tickerText" android:paddingTop="2.0dip" android:layout_width="0.0dip" android:layout_height="wrap_content" android:layout_weight="1.0" android:paddingEnd="10.0dip">
                <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" android:textAlignment="viewStart" />
                <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" android:textAlignment="viewStart" />
            </com.android.systemui.statusbar.phone.TickerView>
        </LinearLayout>
        <ImageView android:layout_gravity="top|left|center" android:id="@id/rounded_corner_ul" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/rounded_corner_ul" />
        <ImageView android:layout_gravity="top|right|center" android:id="@id/rounded_corner_ur" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/rounded_corner_ur" />
    </com.android.systemui.statusbar.phone.PhoneStatusBarView>

    No.

    Try this and as soon as Android tries to run your modified apk, it'll FC. Even if that's the only change that you've made to it.

    Why?

    Well, it's not because you deleted the status icon line...it's because you deleted the line's 'id'

    Let's have another look at the status icon line:

    Code:
    <ImageView 
        android:layout_gravity="center_vertical"
        [color="red"]android:id="@id/status"[/color]
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
    />

    Some of these attributes we'll discuss later, the one we're concerned with right now is 'android:id="@id/status"'

    The attribute 'android:id' is used as a reference. Sometimes they just provide a reminder of what the line does, sometimes they are used by the apk's Java code.

    We've deleted the reference to the status icons, but not the Java/smali code that defines which icons should be shown.

    The apk will run, work out which status icons to show, can't find where they should go, report an error and Android will force the app to close.

    Which is annoying.

    There are three ways we can fix this and stop the status icons from showing without the app FC'ing on us:

    1. We could work out what the hex reference is that's associated with that id, track it through the smali and edit the code as needed. Which is a lot of work. A lot of work.

    2. We could try to make the status icons invisible by setting their height and width to 0.
    Code:
    <ImageView 
        android:layout_gravity="center_vertical"
        android:id="@id/status"
        android:layout_width="[color="red"]0.0dip[/color]"
        android:layout_height="[color="red"]0.0dip[/color]" 
    />
    This works but isn't ideal. Android is still using processing time and power to show those icons, we just can't see them. We're only talking about a handful of icons on the statusbar and the difference in the drain on the processor is negligible, but it's still not best practice.

    3. We can change the lines 'visibility by adding a new attribute..
    Code:
    <ImageView 
        [color="red"]android:visibility="gone"[/color]
        android:layout_gravity="center_vertical"
        android:id="@id/status"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
    />
    This makes Android ignore this line completely. It's not visible to us because Android just doesn't bother drawing it.

    Setting the height and width to 0 isn't the best solution for hiding something but there are times when changing the visibility doesn't work. You may find lines of XML that already have 'android:visibility="gone"' in them. Some ROM's have the option to hide/show certain parts of their UI while running.

    So a line with 'android:visibility="gone"' can be forced to become visible. Changing the height and width to zero stops it from ever becoming visible.

    If the last paragraph didn't really make sense, don't worry about it. For most of the mods you're likely to do, you can use either option 2 or option 3 to stop things from showing. It's up to you. :D

    Basically, if you want to remove a line with an 'android:id' attribute in it..

    Don't Delete It...Hide It!
    32
    *** How To Center The Clock In The Status Bar...Part 2 ***

    So how do we fix this issue of the overlapping notifications with the Simple Method?

    With the Best Method, of course!

    *** The Best Method ***

    This is a bit more involved but is the very best way to center the clock.

    Or anything else.

    In fact, it's a brilliant way to arrange your status bar so you can move anything anywhere.

    The Best Method splits the @id/icons Layout into three unique areas, making it very easy to decide what you want where.

    What we do is we use this basic arrangement:

    Code:
    <LinearLayout android:orientation="horizontal" android:id="@id/icons" android:paddingLeft="6.0dip" android:paddingRight="6.0dip" android:layout_width="fill_parent" android:layout_height="fill_parent">
        <LinearLayout android:id="@+id/Status_Bar_Left_Side" android:orientation="horizontal" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
    
       [COLOR="Red"]<!-- HERE ARE ALL THE CODES FOR THE ITEMS ON THE LEFT SIDE OF THE STATUSBAR -->[/COLOR]
    
        </LinearLayout>
    
       [COLOR="Red"]<!-- HERE ARE ALL THE CODES FOR THE ITEMS IN THE CENTER OF THE STATUSBAR -->[/COLOR]
    
        <RelativeLayout android:id="@+id/Status_Bar_Right_Side" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
            <LinearLayout android:id="@+id/Inside_Status_Bar_Right_Side" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentRight="true">
    
       [COLOR="red"]<!-- HERE ARE ALL THE CODES FOR THE ITEMS ON THE RIGHT SIDE OF THE STATUSBAR -->[/COLOR]
    
            </LinearLayout>
        </RelativeLayout>
    </LinearLayout>

    Make sense? No? Well, don't worry. There is a logic behind all this. Even if it's not obvious.

    This Method basically divides the status bar into just two individual areas. Because those areas have the same 'weight' as each other, they take up exactly the same amount of space as each other. Meaning that whatever goes between those two areas, as long as it doesn't have a weight of 1 or more, will be essentially pushed into the exact center of the status bar.

    So, what we do next is apply this Method to our code from above to create:

    Code:
    [color="red"]<LinearLayout android:orientation="horizontal" android:id="@id/icons" android:paddingLeft="6.0dip" android:paddingRight="6.0dip" android:layout_width="fill_parent" android:layout_height="fill_parent">[/color]
        <LinearLayout android:id="@+id/Status_Bar_Left_Side" android:orientation="horizontal" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
            [color="red"]<LinearLayout android:orientation="horizontal" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
                <com.android.systemui.statusbar.StatusBarIconView android:id="@id/moreIcon" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:visibility="gone" android:src="@drawable/stat_notify_more" />
                <com.android.systemui.statusbar.phone.IconMerger android:orientation="horizontal" android:id="@id/notificationIcons" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center_vertical" android:layout_alignParentLeft="true" />
            </LinearLayout>[/color]
        </LinearLayout>
       [color="red"]<com.android.systemui.statusbar.policy.Clock android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:gravity="center" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:singleLine="true"/>[/color]
        <RelativeLayout android:id="@+id/Status_Bar_Right_Side" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
            <LinearLayout android:id="@+id/Inside_Status_Bar_Right_Side" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentRight="true">
                [color="red"]<LinearLayout android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" android:gravity="center_vertical" />
                <ImageView android:id="@id/stat_no_sim" android:paddingLeft="4.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" android:layout_gravity="center_vertical" />
                <LinearLayout android:orientation="horizontal" android:id="@id/signal_battery_cluster" android:paddingLeft="2.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:gravity="center">
                    <include android:id="@id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/signal_cluster_view" />
                    <ImageView android:id="@id/battery" android:paddingLeft="8.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" />
                </LinearLayout>[/color]
            </LinearLayout>
        </RelativeLayout>
    [color="red"]</LinearLayout>[/color]

    The original code is in red. The only real challenge with this Method is knowing what lines to put in the @id/Status_Bar_Left_Side Layout and which lines to put in the @id/Status_Bar_Right_Side Layout. But take your time, look at the attributes (especially the @id attributes) and it should all become clear.

    picture.php
    picture.php

    See? Doesn't that just look beautiful?

    And so easy to do as well!

    *** The Best Method...On KitKat And Lollipop ***

    When I came up with the Best Method, Google were only just getting ready to give the world Jelly Bean.

    It's two years later and the XML has changed a bit. This is what the stock KitKat status_bar.xml looks like:

    Code:
    <com.android.systemui.statusbar.phone.PhoneStatusBarView android:id="@+id/status_bar" android:background="@drawable/system_bar_background" android:orientation="vertical" android:focusable="true" android:descendantFocusability="afterDescendants" android:fitsSystemWindows="true"
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
        <ImageView android:id="@+id/notification_lights_out" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="match_parent" android:paddingStart="6dip" android:paddingBottom="2dip" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:visibility="gone" />
        <LinearLayout android:id="@+id/status_bar_contents" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingStart="6dip" android:paddingEnd="6dip" android:orientation="horizontal" >
            <LinearLayout android:id="@+id/notification_icon_area" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="1" android:orientation="horizontal" >
                <com.android.systemui.statusbar.StatusBarIconView android:id="@+id/moreIcon" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="match_parent" android:src="@drawable/stat_notify_more" android:visibility="gone" />
                <com.android.systemui.statusbar.phone.IconMerger android:id="@+id/notificationIcons" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentStart="true" android:gravity="center_vertical" android:orientation="horizontal"/>  
            </LinearLayout>
            <LinearLayout android:id="@+id/system_icon_area" android:layout_width="wrap_content" android:layout_height="match_parent" android:orientation="horizontal">
                <LinearLayout android:id="@+id/statusIcons" android:layout_width="wrap_content" android:layout_height="match_parent" android:gravity="center_vertical" android:orientation="horizontal"/>    
                <LinearLayout android:id="@+id/signal_battery_cluster" android:layout_width="wrap_content" android:layout_height="match_parent" android:paddingStart="2dp" android:orientation="horizontal" android:gravity="center" >
                    <include layout="@layout/signal_cluster_view" android:id="@+id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <com.android.systemui.BatteryMeterView android:id="@+id/battery" android:layout_height="16dp" android:layout_width="10.5dp" android:layout_marginBottom="0.33dp" android:layout_marginStart="4dip" />
                </LinearLayout>
                <com.android.systemui.statusbar.policy.Clock android:id="@+id/clock" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:layout_width="wrap_content" android:layout_height="match_parent" android:singleLine="true" android:paddingStart="6dip" android:gravity="center_vertical|start" />
            </LinearLayout>
        </LinearLayout>
        <LinearLayout android:id="@+id/ticker" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingStart="6dip" android:animationCache="false" android:orientation="horizontal" >
            <ImageSwitcher android:id="@+id/tickerIcon" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:layout_marginEnd="4dip" >
                <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="center" />
                <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="center" />
            </ImageSwitcher>
            <com.android.systemui.statusbar.phone.TickerView android:id="@+id/tickerText" android:layout_width="0dip" android:layout_weight="1" android:layout_height="wrap_content" android:paddingTop="2dip" android:paddingEnd="10dip">
                <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" />
                <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" />
            </com.android.systemui.statusbar.phone.TickerView>
        </LinearLayout>
    </com.android.systemui.statusbar.phone.PhoneStatusBarView>

    It looks similar to the code at the top of this post but there are significant differences. The @id/icons Layout has been replaced with a @id/status_bar_contents Layout which looks a lot more complex.

    But it isn't, really. We can still use the Best Method on it. And it's actually quite easy to do.

    The Best Method splits the status bar into two individual areas. The @id/status_bar_contents Layout splits the status bar into two individual areas.

    Half the work is done for us.

    We just need to make four very simple changes..

    Code:
    <com.android.systemui.statusbar.phone.PhoneStatusBarView android:id="@+id/status_bar" android:background="@drawable/system_bar_background" android:orientation="vertical" android:focusable="true" android:descendantFocusability="afterDescendants" android:fitsSystemWindows="true"
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
        <ImageView android:id="@+id/notification_lights_out" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="match_parent" android:paddingStart="6dip" android:paddingBottom="2dip" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:visibility="gone" />
        <LinearLayout android:id="@+id/status_bar_contents" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingStart="6dip" android:paddingEnd="6dip" android:orientation="horizontal" >
            <LinearLayout android:id="@+id/notification_icon_area" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="1" android:orientation="horizontal" >
                <com.android.systemui.statusbar.StatusBarIconView android:id="@+id/moreIcon" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="match_parent" android:src="@drawable/stat_notify_more" android:visibility="gone" />
                <com.android.systemui.statusbar.phone.IconMerger android:id="@+id/notificationIcons" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentStart="true" android:gravity="center_vertical" android:orientation="horizontal"/>  
            </LinearLayout>
    [color="red"]        <com.android.systemui.statusbar.policy.Clock android:id="@+id/clock" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:layout_width="wrap_content" android:layout_height="match_parent" android:singleLine="true" android:gravity="center_vertical|start" />[/color]
            <LinearLayout android:id="@+id/system_icon_area" [color="red"]android:layout_width="0dip" android:layout_weight="1"[/color] android:layout_height="match_parent" android:orientation="horizontal">
                [color="red"]<View android:visibility="invisible" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0" />[/color]
                <LinearLayout android:id="@+id/statusIcons" android:layout_width="wrap_content" android:layout_height="match_parent" android:gravity="center_vertical" android:orientation="horizontal"/>    
                <LinearLayout android:id="@+id/signal_battery_cluster" android:layout_width="wrap_content" android:layout_height="match_parent" android:paddingStart="2dp" android:orientation="horizontal" android:gravity="center" >
                    <include layout="@layout/signal_cluster_view" android:id="@+id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <com.android.systemui.BatteryMeterView android:id="@+id/battery" android:layout_height="16dp" android:layout_width="10.5dp" android:layout_marginBottom="0.33dp" android:layout_marginStart="4dip" />
                </LinearLayout>
            </LinearLayout>
        </LinearLayout>
        <LinearLayout android:id="@+id/ticker" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingStart="6dip" android:animationCache="false" android:orientation="horizontal" >
            <ImageSwitcher android:id="@+id/tickerIcon" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:layout_marginEnd="4dip" >
                <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="center" />
                <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="center" />
            </ImageSwitcher>
            <com.android.systemui.statusbar.phone.TickerView android:id="@+id/tickerText" android:layout_width="0dip" android:layout_weight="1" android:layout_height="wrap_content" android:paddingTop="2dip" android:paddingEnd="10dip">
                <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" />
                <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" />
            </com.android.systemui.statusbar.phone.TickerView>
        </LinearLayout>
    </com.android.systemui.statusbar.phone.PhoneStatusBarView>

    I've highlighted three of those four changes in red. The fourth you can't see as I just deleted the android:paddingStart="6dip" attribute from the clock line, to keep the clock centered.

    The View line pushes the contents of the @id/system_icon_area Layout to the far right of the screen. The contents of the other Layout are already on the far left of the screen. So what's between should be in the center..

    attachment.php

    (thanks to @bobfrantic for the picture)​



    So that's KitKat, but what about Android 5.0? What about Lollipop?

    Well, this is the stock Lollipop status_bar.xml:

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <com.android.systemui.statusbar.phone.PhoneStatusBarView android:orientation="vertical" android:id="@id/status_bar" android:background="@drawable/system_bar_background" android:focusable="true" android:descendantFocusability="afterDescendants"
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
        <ImageView android:id="@id/notification_lights_out" android:paddingBottom="2.0dip" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:paddingStart="6.0dip" />
        <LinearLayout android:orientation="horizontal" android:id="@id/status_bar_contents" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingStart="6.0dip" android:paddingEnd="8.0dip">
            <com.android.systemui.statusbar.AlphaOptimizedFrameLayout android:orientation="horizontal" android:id="@id/notification_icon_area" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
                <com.android.keyguard.AlphaOptimizedLinearLayout android:id="@id/notification_icon_area_inner" android:layout_width="fill_parent" android:layout_height="fill_parent">
                    <com.android.systemui.statusbar.StatusBarIconView android:id="@id/moreIcon" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/stat_notify_more" />
                    <com.android.systemui.statusbar.phone.IconMerger android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/notificationIcons" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentStart="true" />
                </com.android.keyguard.AlphaOptimizedLinearLayout>
            </com.android.systemui.statusbar.AlphaOptimizedFrameLayout>
            <com.android.keyguard.AlphaOptimizedLinearLayout android:orientation="horizontal" android:id="@id/system_icon_area" android:layout_width="wrap_content" android:layout_height="fill_parent">
                <include layout="@layout/system_icons" />
                <com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="start|center" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:paddingStart="7.0dip" />
            </com.android.keyguard.AlphaOptimizedLinearLayout>
        </LinearLayout>
        <ViewStub android:id="@id/ticker_stub" android:layout="@layout/status_bar_ticker" android:inflatedId="@id/ticker" android:layout_width="fill_parent" android:layout_height="fill_parent" />
    </com.android.systemui.statusbar.phone.PhoneStatusBarView>

    Look closely and you'll notice that the @id/status_bar_contents Layout is still just divided into two areas: @id/notification_icon_area and @id/system_icon_area.

    Adding the Best Method to that shouldn't be a problem at all...
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <com.android.systemui.statusbar.phone.PhoneStatusBarView android:orientation="vertical" android:id="@id/status_bar" android:background="@drawable/system_bar_background" android:focusable="true" android:descendantFocusability="afterDescendants"
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
        <ImageView android:id="@id/notification_lights_out" android:paddingBottom="2.0dip" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:paddingStart="6.0dip" />
        <LinearLayout android:orientation="horizontal" android:id="@id/status_bar_contents" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingStart="6.0dip" android:paddingEnd="8.0dip">
            <com.android.systemui.statusbar.AlphaOptimizedFrameLayout android:orientation="horizontal" android:id="@id/notification_icon_area" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
                <com.android.keyguard.AlphaOptimizedLinearLayout android:id="@id/notification_icon_area_inner" android:layout_width="fill_parent" android:layout_height="fill_parent">
                    <com.android.systemui.statusbar.StatusBarIconView android:id="@id/moreIcon" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/stat_notify_more" />
                    <com.android.systemui.statusbar.phone.IconMerger android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/notificationIcons" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentStart="true" />
                </com.android.keyguard.AlphaOptimizedLinearLayout>
            </com.android.systemui.statusbar.AlphaOptimizedFrameLayout>
            <com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="start|center" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
            <com.android.keyguard.AlphaOptimizedLinearLayout android:orientation="horizontal" android:id="@id/system_icon_area" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0" >
                <View android:visibility="invisible" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0" />
                <include layout="@layout/system_icons" />
            </com.android.keyguard.AlphaOptimizedLinearLayout>
        </LinearLayout>
        <ViewStub android:id="@id/ticker_stub" android:layout="@layout/status_bar_ticker" android:inflatedId="@id/ticker" android:layout_width="fill_parent" android:layout_height="fill_parent" />
    </com.android.systemui.statusbar.phone.PhoneStatusBarView>

    Now, we're nearly there but there's still work to be done.

    In Lollipop, the clock on the status bar isn't shown when the device is locked. There's not much need for it when you have a bigger clock on the lockscreen anyway. But, when we move the clock to get it centered, the clock doesn't disappear. It's always visible.

    To make the clock vanish when the device is locked, you'll need to do a smali mod. Have a look at this post by @S0bes to see what to do: http://xdaforums.com/showpost.php?p=58460343&postcount=172

    *** Using The Best Method On Xperia KitKat ***

    For their KitKat ROM's, Sony have done something a bit different with their XML. There's not enough space here for me to say what to do about it, so have a look at my post here instead: http://xdaforums.com/showpost.php?p=59569708&postcount=297


    *** Anything Else, Ticklefish? ***

    Nope, that's it. This is the longest post in this thread so far. And probably the hardest to follow.

    So I'll let you take a break now so you can try some XML modding for yourself.

    I'll be updating this thread in time with other fun mods to try. But, for now, have some fun and see what you can come up with.

    If you have any questions, or need any help, feel free to ask. I'm always happy to help and I'm hoping that some of the people I've helped over the years will be prepared to help out as well.

    One final thing...ALWAYS MAKE A BACKUP!!!

    YIVAMgo.png
    25
    *** android:layout_gravity, android:gravity AND android:layout_weight ***

    Centering the clock in the previous two posts wouldn't have been possible without using two particular attributes: 'android:gravity' and 'android:layout_weight'.

    In physics, weight is the result of gravity acting on mass. But this isn't physics, it's Android, so what do these attributes actually mean?

    *** GRAVITY ***

    In Android, the gravity of an object changes how it's laid out in the space it occupies.

    Let's have a few practical examples to better explain..

    Here's a blank status bar.

    bv6GM9p.png

    Let's add a simple clock to it.

    Code:
    <com.android.systemui.statusbar.policy.Clock
        android:id="@id/clock"
        android:background="#ff33b5e5"
        android:textColor="#ffffffff"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
    />

    I've missed a few attributes that you'd normally find in a real XML file, just to keep it simple. But I have added an attribute that sets the background colour to Holo Blue Light. You'll see how useful that is as I continue..

    Here's my status bar now.

    w1NjDdH.png

    (DISCLAIMER: This isn't a real status bar. It's just something I put together in a picture-editing program on my PC. Doing these images with a real status bar would take forever...)

    Let's add a gravity attribute to get this clock centered..

    Code:
    <com.android.systemui.statusbar.policy.Clock
        android:id="@id/clock"
    [COLOR="Red"]    android:gravity="center"[/COLOR]
        android:background="#ff33b5e5"
        android:textColor="#ffffffff"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
    />

    This gives us this..

    8mMaXJ1.png

    That didn't work. The android:gravity attribute changes how an object is laid out, but only in its own space. The clock is now centered in that space, but not the statusbar.

    So let's expand that space.

    Code:
    <com.android.systemui.statusbar.policy.Clock
        android:id="@id/clock"
        android:background="#ff33b5e5"
        android:textColor="#ffffffff"
    [COLOR="Red"]    android:layout_width="fill_parent"[/COLOR]
        android:layout_height="fill_parent"
    />

    Which looks like:

    bQ1hHSf.png

    Oops, forgot that gravity attribute!

    Code:
    <com.android.systemui.statusbar.policy.Clock
        android:id="@id/clock"
    [COLOR="Red"]    android:gravity="center"[/COLOR]
        android:background="#ff33b5e5"
        android:textColor="#ffffffff"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
    />

    Here's the result.

    AydlRwW.png

    Better, no?

    So what's the difference between android:gravity and android:layout_gravity?

    Well, android:layout_gravity affects how an object is laid out, not in its own space, but in its parent Layout.

    Let's try using that to center the clock:

    Code:
    <com.android.systemui.statusbar.policy.Clock
        android:id="@id/clock"
    [COLOR="Red"]    android:layout_gravity="center"[/COLOR]
        android:background="#ff33b5e5"
        android:textColor="#ffffffff"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
    />

    Here's the result:

    w1NjDdH.png

    So why didn't that work? Well, it really depends on that parent Layout.

    In a LinearLayout, some of the layout_gravity attributes are ignored. This would have worked in a RelativeLayout but, as we saw in the Simple Method two posts ago, other objects can overlap the clock.

    Generally when you're modding, you normally only worry about layout_gravity when using a RelativeLayout or FrameLayout.

    For your reference, here's are the values you can set your gravity to. This is taken direct from Google themselves.

    Google said:
    top - Push object to the top of its container, not changing its size.
    bottom - Push object to the bottom of its container, not changing its size.
    left - Push object to the left of its container, not changing its size.
    right - Push object to the right of its container, not changing its size.
    center_vertical - Place object in the vertical center of its container, not changing its size.
    fill_vertical - Grow the vertical size of the object if needed so it completely fills its container.
    center_horizontal - Place object in the horizontal center of its container, not changing its size.
    fill_horizontal - Grow the horizontal size of the object if needed so it completely fills its container.
    center - Place the object in the center of its container in both the vertical and horizontal axis, not changing its size.
    fill - Grow the horizontal and vertical size of the object if needed so it completely fills its container.
    clip_vertical - Additional option that can be set to have the top and/or bottom edges of the child clipped to its container's bounds. The clip will be based on the vertical gravity: a top gravity will clip the bottom edge, a bottom gravity will clip the top edge, and neither will clip both edges.
    clip_horizontal - Additional option that can be set to have the left and/or right edges of the child clipped to its container's bounds. The clip will be based on the horizontal gravity: a left gravity will clip the right edge, a right gravity will clip the left edge, and neither will clip both edges.
    start - Push object to the beginning of its container, not changing its size.
    end - Push object to the end of its container, not changing its size.

    Most of those you'll rarely, if ever, use while modding. But it's handy to know about them!

    *** WEIGHT ***

    Weight is a trickier concept to understand.

    Google, on their developer website, have this to say about the layout_weight attribute:

    Google said:
    The weight value is a number that specifies the amount of remaining space each view should consume, relative to the amount consumed by sibling views. This works kind of like the amount of ingredients in a drink recipe: "2 parts vodka, 1 part coffee liqueur" means two-thirds of the drink is vodka. For example, if you give one view a weight of 2 and another one a weight of 1, the sum is 3, so the first view fills 2/3 of the remaining space and the second view fills the rest. If you add a third view and give it a weight of 1, then the first view (with weight of 2) now gets 1/2 the remaining space, while the remaining two each get 1/4.

    In my opinion, this isn't the best explanation ever. It makes things too confusing. (Although it does say a lot about work practices inside Google HQ...clearly I have the wrong job!)

    Let me see if I can't explain it a little bit better..

    Here's our blank status bar again.

    bv6GM9p.png

    Let's say we want a notification icon and a signal icon here.

    Code:
    <LinearLayout
        android:orientation="horizontal"
        android:id="status_bar_contents"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
    >
        <com.android.systemui.statusbar.phone.IconMerger 
            android:id="@id/notificationIcons"
            android:background="#ff0099cc"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
        />
        <ImageView
            android:id="@id/mobile_signal"
            android:background="#ff33b5e5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
        />
    </LinearLayout>

    As before, I've missed out a few attributes that you'd have in the real code, just to make things a bit simpler to read.
    And, as before, I've added a background to the signal icon. This time I'm using Holo Blue Dark (I like Holo Blue...).

    This makes our status bar look like this:

    Y648p51.png

    I'm sure you've noticed on your status bar that the notification icons are on the left and the signal icon on the right. That's easy enough to do with a RelativeLayout or a FrameLayout but, if we have too many notifications, we would be overlapping the signal icon.

    So, to do this in a LinearLayout, we use layout_weight.

    This attribute essentially sets the priority for the object it's attached to.
    By default, an object has a layout_weight of 0 (even if there's no layout_weight attribute in the code). So, if we give an object a layout_weight of 1, Android will allocate it more space.

    Let's see it in action by changing the layout_weight of our notification icons to 1:

    Code:
    <LinearLayout
        android:orientation="horizontal"
        android:id="status_bar_contents"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
    >
        <com.android.systemui.statusbar.phone.IconMerger 
            android:id="@id/notificationIcons"
    [COLOR="Red"]        android:layout_weight="1"[/COLOR]
            android:background="#ff0099cc"
            android:layout_width="0.0dip"
            android:layout_height="fill_parent"
        />
        <ImageView
            android:id="@id/mobile_signal"
            android:background="#ff33b5e5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
        />
    </LinearLayout>

    Android now gives that object as much space in the Layout as it can, effectively pushing the signal icon to the far right.

    esZR6wd.png

    Because the width of the notification icon object is being changed by the layout_weight, the layout_width attribute is superseded. So you should always set it to "0.0dip", this stops Android from having to waste processing power that's not needed.
    Since this is only the status bar, we're not talking about a lot of power and it's doubtful you'd notice any difference in performance. But it's always good practice.

    This is essentially how the standard Android status bar is set up.
    Yes, there are more icons and more Layout but, at its heart, there is still a notification area with a weight of 1 pushing a status icon area with a weight of 0 to the right of the screen.
    Have a look at your status_bar.xml and you'll see what I mean!

    For fun, let's see what happens if we change the weight of the signal icon as well...

    Code:
    <LinearLayout
        android:orientation="horizontal"
        android:id="status_bar_contents"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
    >
        <com.android.systemui.statusbar.phone.IconMerger 
            android:id="@id/notificationIcons"
    [COLOR="Red"]        android:layout_weight="1"[/COLOR]
            android:background="#ff0099cc"
    [COLOR="Red"]        android:layout_width="0.0dip"[/COLOR]
            android:layout_height="fill_parent"
        />
        <ImageView
            android:id="@id/mobile_signal"
    [COLOR="Red"]        android:layout_weight="1"[/COLOR]
            android:background="#ff33b5e5"
    [COLOR="Red"]        android:layout_width="0.0dip"[/COLOR]
            android:layout_height="wrap_content"
        />
    </LinearLayout>

    This results in:

    GeKPH8i.png

    That looks a bit stupid. But not to worry, we can use a spacer to push that signal icon back to the right of the screen again.

    Code:
    <LinearLayout
        android:orientation="horizontal"
        android:id="status_bar_contents"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
    >
        <com.android.systemui.statusbar.phone.IconMerger 
            android:id="@id/notificationIcons"
            android:layout_weight="1"
            android:background="#ff0099cc"
            android:layout_width="0.0dip"
            android:layout_height="fill_parent"
        />
        <LinearLayout
            android:orientation="horizontal"
            android:layout_weight="1"
            android:layout_width="0.0dip"
            android:background="#ff33b5e5"
            android:layout_height="fill_parent"
        >
            [color="red"]<View
                android:visibility="invisible"
                android:layout_width="0.0dip"
                android:layout_height="fill_parent"
                android:layout_weight="1"
            />[/color]
            <ImageView
                android:id="@id/mobile_signal"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
            />
        </LinearLayout>
    </LinearLayout>

    Here we go..

    U1usj6l.png

    I've changed the signal icon's weight back to 0 and put it inside a LinearLayout with a View object that has a weight of 1.

    The View line pushes the signal icon to the far right but has this attribute: "android:visibility="invisible"". Remember this attribute from a few posts ago? If this is set to !invisible, Android doesn't show it but still pays attention to how much space it uses. Making it the perfect spacer!

    Why am I doing this? Well, look what happens if we add a clock to all this code (using a background of Holo Blue Bright this time)...

    Code:
    <LinearLayout
        android:orientation="horizontal"
        android:id="status_bar_contents"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
    >
        <com.android.systemui.statusbar.phone.IconMerger 
            android:id="@id/notificationIcons"
            android:layout_weight="1"
            android:background="#ff0099cc"
            android:layout_width="0.0dip"
            android:layout_height="fill_parent"
        />
       [COLOR="Red"] <com.android.systemui.statusbar.policy.Clock
            android:id="@id/clock"
            android:layout_gravity="center"
            android:background="#00ddff"
            android:textColor="#ffffffff"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
        />[/COLOR]
        <LinearLayout
            android:orientation="horizontal"
            android:layout_weight="1"
            android:layout_width="0.0dip"
            android:background="#ff33b5e5"
            android:layout_height="fill_parent"
        >
            <View
                android:visibility="invisible"
                android:layout_width="0.0dip"
                android:layout_height="fill_parent"
                android:layout_weight="1"
            />
            <ImageView
                android:id="@id/mobile_signal"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
            />
        </LinearLayout>
    </LinearLayout>

    Here it is:

    OobY3fU.png

    Well, would you look at that? We've just centered the clock! Neat!

    Let's remove those background attributes..

    Code:
    <LinearLayout
        android:orientation="horizontal"
        android:id="status_bar_contents"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
    >
        <com.android.systemui.statusbar.phone.IconMerger 
            android:id="@id/notificationIcons"
            android:layout_weight="1"
            android:layout_width="0.0dip"
            android:layout_height="fill_parent"
        />
        <com.android.systemui.statusbar.policy.Clock
            android:id="@id/clock"
            android:layout_gravity="center"
            android:textColor="#ffffffff"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
        />
        <LinearLayout
            android:orientation="horizontal"
            android:layout_weight="1"
            android:layout_width="0.0dip"
            android:layout_height="fill_parent"
        >
            <View
                android:visibility="invisible"
                android:layout_width="0.0dip"
                android:layout_height="fill_parent"
                android:layout_weight="1"
            />
            <ImageView
                android:id="@id/mobile_signal"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
            />
        </LinearLayout>
    </LinearLayout>

    Et voilà...

    Hu5fCC0.png

    Have another look at the previous two posts. Hopefully they should make a bit more sense now...
    25
    *** How To Put An Invisible Softkey In The Status Bar ***

    Softkeys are the buttons that are found in the navigation bar at the bottom of the screen. They are normally buttons for BACK, HOME, RECENT APPS and MENU. Although it's not unusual to find some roms with a SEARCH softkey or even some volume controls.

    The status bar is the bit at the top of the screen that shows the clock, battery level, signal strength, etc.

    Because phones and tablets are getting bigger and bigger, it'd be quite handy to put at least one softkey in it so we don't have to haul our finger all the way to the other end of the screen (trust me, every second counts!).

    How hard is it to use something that's in one XML file (navigation_bar.xml) inside a different XML file (status_bar.xml)?

    Actually, it's not hard at all!

    As with a lot of things to do with the system user interface, we need to decompile our SystemUI.apk. Here's what the stock KitKat navigation_bar.xml looks like:

    Code:
    <com.android.systemui.statusbar.phone.NavigationBarView android:layout_height="match_parent" android:layout_width="match_parent" android:background="@drawable/system_bar_background"
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
        <FrameLayout android:id="@+id/rot0" android:layout_height="match_parent" android:layout_width="match_parent" >
            <LinearLayout android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="horizontal" android:clipChildren="false" android:clipToPadding="false" android:id="@+id/nav_buttons" android:animateLayoutChanges="true" >
                <View android:layout_width="40dp" android:layout_height="match_parent" android:layout_weight="0" android:visibility="invisible" />
                <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back" android:layout_width="@dimen/navigation_key_width" android:layout_height="match_parent" android:src="@drawable/ic_sysbar_back" systemui:keyCode="4" android:layout_weight="0" android:scaleType="center" systemui:glowBackground="@drawable/ic_sysbar_highlight" android:contentDescription="@string/accessibility_back" />
                <View android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:visibility="invisible" />
                <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home" android:layout_width="@dimen/navigation_key_width" android:layout_height="match_parent" android:src="@drawable/ic_sysbar_home" systemui:keyCode="3" systemui:keyRepeat="false" android:layout_weight="0" systemui:glowBackground="@drawable/ic_sysbar_highlight" android:contentDescription="@string/accessibility_home" />
                <View android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:visibility="invisible" />
                <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/recent_apps" android:layout_width="@dimen/navigation_key_width" android:layout_height="match_parent" android:src="@drawable/ic_sysbar_recent" android:layout_weight="0" systemui:glowBackground="@drawable/ic_sysbar_highlight" android:contentDescription="@string/accessibility_recent" />
                <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu" android:layout_width="@dimen/navigation_menu_key_width" android:layout_height="match_parent" android:src="@drawable/ic_sysbar_menu" systemui:keyCode="82" android:layout_weight="0" android:visibility="invisible" android:contentDescription="@string/accessibility_menu" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
            </LinearLayout>
            <LinearLayout android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="horizontal" android:id="@+id/lights_out" android:visibility="gone" >
                <ImageView android:layout_width="80dp" android:layout_height="match_parent" android:layout_marginStart="40dp" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:layout_weight="0" />
                <View android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:visibility="invisible" />
                <ImageView android:layout_width="80dp" android:layout_height="match_parent" android:src="@drawable/ic_sysbar_lights_out_dot_large" android:scaleType="center" android:layout_weight="0" />
                <View android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:visibility="invisible" />
                <ImageView android:layout_width="80dp" android:layout_marginEnd="40dp" android:layout_height="match_parent" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:layout_weight="0" />
            </LinearLayout>
            <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent">
                <com.android.systemui.statusbar.policy.KeyButtonView android:layout_width="80dp" android:id="@+id/search_light" android:layout_height="match_parent" android:layout_gravity="center" android:src="@drawable/search_light" android:scaleType="center" android:visibility="gone" android:contentDescription="@string/accessibility_search_light" />
                <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/camera_button" android:layout_height="match_parent" android:layout_width="80dp" android:layout_gravity="center_vertical|right" android:src="@drawable/ic_sysbar_camera" android:scaleType="center" android:visibility="gone" android:contentDescription="@string/accessibility_camera_button" />
            </FrameLayout>
            <com.android.systemui.statusbar.policy.DeadZone android:id="@+id/deadzone" android:layout_height="match_parent" android:layout_width="match_parent" systemui:minSize="@dimen/navigation_bar_deadzone_size" systemui:maxSize="@dimen/navigation_bar_deadzone_size_max" systemui:holdTime="@integer/navigation_bar_deadzone_hold" systemui:decayTime="@integer/navigation_bar_deadzone_decay" systemui:orientation="horizontal" android:layout_gravity="top" />
        </FrameLayout>
        <FrameLayout android:id="@+id/rot90" android:layout_height="match_parent" android:layout_width="match_parent" android:visibility="gone" android:paddingTop="0dp" >
            <LinearLayout android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" android:clipChildren="false" android:clipToPadding="false" android:id="@+id/nav_buttons" android:animateLayoutChanges="true" >
                <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu" android:layout_height="40dp" android:layout_width="match_parent" android:src="@drawable/ic_sysbar_menu_land" systemui:keyCode="82" android:layout_weight="0" android:visibility="invisible" android:contentDescription="@string/accessibility_menu" systemui:glowBackground="@drawable/ic_sysbar_highlight_land" />
                <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/recent_apps" android:layout_height="80dp" android:layout_width="match_parent" android:src="@drawable/ic_sysbar_recent_land" android:layout_weight="0" android:contentDescription="@string/accessibility_recent" systemui:glowBackground="@drawable/ic_sysbar_highlight_land" />
                <View android:layout_height="match_parent" android:layout_width="match_parent" android:layout_weight="1" android:visibility="invisible" />
                <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home" android:layout_height="80dp" android:layout_width="match_parent" android:src="@drawable/ic_sysbar_home_land" systemui:keyCode="3" systemui:keyRepeat="false" android:layout_weight="0" android:contentDescription="@string/accessibility_home" systemui:glowBackground="@drawable/ic_sysbar_highlight_land" />
                <View android:layout_height="match_parent" android:layout_width="match_parent" android:layout_weight="1" android:visibility="invisible" />
                <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back" android:layout_height="80dp" android:layout_width="match_parent" android:src="@drawable/ic_sysbar_back_land" android:scaleType="center" systemui:keyCode="4" android:layout_weight="0" android:contentDescription="@string/accessibility_back" systemui:glowBackground="@drawable/ic_sysbar_highlight_land" />
                <View android:layout_height="40dp" android:layout_width="match_parent" android:layout_weight="0" android:visibility="invisible" />
            </LinearLayout>
            <LinearLayout android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" android:id="@+id/lights_out" android:visibility="gone" >
                <ImageView android:layout_height="80dp" android:layout_marginTop="40dp" android:layout_width="match_parent" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:layout_weight="0" />
                <View android:layout_height="match_parent" android:layout_width="match_parent" android:layout_weight="1" android:visibility="invisible" />
                <ImageView android:layout_height="80dp" android:layout_width="match_parent" android:src="@drawable/ic_sysbar_lights_out_dot_large" android:scaleType="center" android:layout_weight="0" />
                <View android:layout_height="match_parent" android:layout_width="match_parent" android:layout_weight="1" android:visibility="invisible" />
                <ImageView android:layout_height="80dp" android:layout_marginBottom="40dp" android:layout_width="match_parent" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:layout_weight="0" />
            </LinearLayout>
            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/search_light" android:layout_height="80dp" android:layout_width="match_parent" android:layout_gravity="center_vertical" android:src="@drawable/search_light_land" android:scaleType="center" android:visibility="gone" android:contentDescription="@string/accessibility_search_light" />
            <com.android.systemui.statusbar.policy.DeadZone android:id="@+id/deadzone" android:layout_height="match_parent" android:layout_width="match_parent" systemui:minSize="@dimen/navigation_bar_deadzone_size" systemui:maxSize="@dimen/navigation_bar_deadzone_size_max" systemui:holdTime="@integer/navigation_bar_deadzone_hold" systemui:decayTime="@integer/navigation_bar_deadzone_decay" systemui:orientation="vertical" android:layout_gravity="top" />
        </FrameLayout>
        <View android:id="@+id/rot270" android:layout_height="match_parent" android:layout_width="match_parent" android:visibility="gone" />
    </com.android.systemui.statusbar.phone.NavigationBarView>

    This is relatively dense code and it can be hard to work out just what it's doing but it does all make sense. For now though, all we need is just one line. Let's say we want to put a HOME softkey in our statusbar. In that case, we just want a line with 'home' in it.

    And here it is:

    Code:
    <com.android.systemui.statusbar.policy.KeyButtonView
        [color="red"]android:id="@+id/home"[/color]
        android:layout_width="@dimen/navigation_key_width"
        android:layout_height="match_parent"
        android:src="@drawable/ic_sysbar_home"
        systemui:keyCode="3"
        systemui:keyRepeat="false"
        android:layout_weight="0"
        systemui:glowBackground="@drawable/ic_sysbar_highlight"
        android:contentDescription="@string/accessibility_home" 
    />

    We're going to put that into our status bar, so let's have a look at our status_bar.xml:

    Code:
    <com.android.systemui.statusbar.phone.PhoneStatusBarView android:id="@+id/status_bar" android:background="@drawable/system_bar_background" android:orientation="vertical" android:focusable="true" android:descendantFocusability="afterDescendants" android:fitsSystemWindows="true"
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
        <ImageView android:id="@+id/notification_lights_out" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="match_parent" android:paddingStart="6dip" android:paddingBottom="2dip" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:visibility="gone" />
        <LinearLayout android:id="@+id/status_bar_contents" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingStart="6dip" android:paddingEnd="6dip" android:orientation="horizontal" >
            <LinearLayout android:id="@+id/notification_icon_area" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="1" android:orientation="horizontal" >
                <com.android.systemui.statusbar.StatusBarIconView android:id="@+id/moreIcon" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="match_parent" android:src="@drawable/stat_notify_more" android:visibility="gone" />
                <com.android.systemui.statusbar.phone.IconMerger android:id="@+id/notificationIcons" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentStart="true" android:gravity="center_vertical" android:orientation="horizontal"/>  
            </LinearLayout>
            <LinearLayout android:id="@+id/system_icon_area" android:layout_width="wrap_content" android:layout_height="match_parent" android:orientation="horizontal">
                <LinearLayout android:id="@+id/statusIcons" android:layout_width="wrap_content" android:layout_height="match_parent" android:gravity="center_vertical" android:orientation="horizontal"/>    
                <LinearLayout android:id="@+id/signal_battery_cluster" android:layout_width="wrap_content" android:layout_height="match_parent" android:paddingStart="2dp" android:orientation="horizontal" android:gravity="center" >
                    <include layout="@layout/signal_cluster_view" android:id="@+id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <com.android.systemui.BatteryMeterView android:id="@+id/battery" android:layout_height="16dp" android:layout_width="10.5dp" android:layout_marginBottom="0.33dp" android:layout_marginStart="4dip" />
                </LinearLayout>
                <com.android.systemui.statusbar.policy.Clock android:id="@+id/clock" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:layout_width="wrap_content" android:layout_height="match_parent" android:singleLine="true" android:paddingStart="6dip" android:gravity="center_vertical|start" />
            </LinearLayout>
        </LinearLayout>
        <LinearLayout android:id="@+id/ticker" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingStart="6dip" android:animationCache="false" android:orientation="horizontal" >
            <ImageSwitcher android:id="@+id/tickerIcon" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:layout_marginEnd="4dip" >
                <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="center" />
                <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="center" />
            </ImageSwitcher>
            <com.android.systemui.statusbar.phone.TickerView android:id="@+id/tickerText" android:layout_width="0dip" android:layout_weight="1" android:layout_height="wrap_content" android:paddingTop="2dip" android:paddingEnd="10dip">
                <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" />
                <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" />
            </com.android.systemui.statusbar.phone.TickerView>
        </LinearLayout>
    </com.android.systemui.statusbar.phone.PhoneStatusBarView>

    Being right-handed, I might as well put my HOME softkey to the right of the clock. That way, it's as close to the right side of the status bar as possible. All I need to do is just copy and paste..

    Code:
    <com.android.systemui.statusbar.phone.PhoneStatusBarView android:id="@+id/status_bar" android:background="@drawable/system_bar_background" android:orientation="vertical" android:focusable="true" android:descendantFocusability="afterDescendants" android:fitsSystemWindows="true"
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
        <ImageView android:id="@+id/notification_lights_out" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="match_parent" android:paddingStart="6dip" android:paddingBottom="2dip" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:visibility="gone" />
        <LinearLayout android:id="@+id/status_bar_contents" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingStart="6dip" android:paddingEnd="6dip" android:orientation="horizontal" >
            <LinearLayout android:id="@+id/notification_icon_area" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="1" android:orientation="horizontal" >
                <com.android.systemui.statusbar.StatusBarIconView android:id="@+id/moreIcon" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="match_parent" android:src="@drawable/stat_notify_more" android:visibility="gone" />
                <com.android.systemui.statusbar.phone.IconMerger android:id="@+id/notificationIcons" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentStart="true" android:gravity="center_vertical" android:orientation="horizontal"/>  
            </LinearLayout>
            <LinearLayout android:id="@+id/system_icon_area" android:layout_width="wrap_content" android:layout_height="match_parent" android:orientation="horizontal">
                <LinearLayout android:id="@+id/statusIcons" android:layout_width="wrap_content" android:layout_height="match_parent" android:gravity="center_vertical" android:orientation="horizontal"/>    
                <LinearLayout android:id="@+id/signal_battery_cluster" android:layout_width="wrap_content" android:layout_height="match_parent" android:paddingStart="2dp" android:orientation="horizontal" android:gravity="center" >
                    <include layout="@layout/signal_cluster_view" android:id="@+id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <com.android.systemui.BatteryMeterView android:id="@+id/battery" android:layout_height="16dp" android:layout_width="10.5dp" android:layout_marginBottom="0.33dp" android:layout_marginStart="4dip" />
                </LinearLayout>
                <com.android.systemui.statusbar.policy.Clock android:id="@+id/clock" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:layout_width="wrap_content" android:layout_height="match_parent" android:singleLine="true" android:paddingStart="6dip" android:gravity="center_vertical|start" />
                [color="red"]<com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home" android:layout_width="@dimen/navigation_key_width" android:layout_height="match_parent" android:src="@drawable/ic_sysbar_home" systemui:keyCode="3" systemui:keyRepeat="false" android:layout_weight="0" systemui:glowBackground="@drawable/ic_sysbar_highlight" android:contentDescription="@string/accessibility_home" />[/color]
            </LinearLayout>
        </LinearLayout>
        <LinearLayout android:id="@+id/ticker" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingStart="6dip" android:animationCache="false" android:orientation="horizontal" >
            <ImageSwitcher android:id="@+id/tickerIcon" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:layout_marginEnd="4dip" >
                <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="center" />
                <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="center" />
            </ImageSwitcher>
            <com.android.systemui.statusbar.phone.TickerView android:id="@+id/tickerText" android:layout_width="0dip" android:layout_weight="1" android:layout_height="wrap_content" android:paddingTop="2dip" android:paddingEnd="10dip">
                <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" />
                <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" />
            </com.android.systemui.statusbar.phone.TickerView>
        </LinearLayout>
    </com.android.systemui.statusbar.phone.PhoneStatusBarView>

    And, once I've saved, recompiled and flashed back to the phone, here's the result:

    fEvItFT.png

    *** But That's Not Invisible, Ticklefish!! ***

    You're right, it's not. Not only is the softkey taking up space on my status bar because it's visible, but it also looks a little squashed.

    We can change the icon to make it look a bit better...but we're better off doing something a little cleverer..

    For this, we're going to use a RelativeLayout to put the clock and the softkey on top of each other. And we need to make a few changes to the attributes of those lines:

    Code:
    <RelativeLayout android:layout_width="wrap_content" android:layout_height="fill_parent">
       <com.android.systemui.statusbar.policy.Clock android:layout_alignParentRight="true" android:id="@+id/clock" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:layout_width="wrap_content" android:layout_height="match_parent" android:singleLine="true" android:paddingStart="6dip" android:gravity="center_vertical|start" />
       <com.android.systemui.statusbar.policy.KeyButtonView android:layout_alignParentRight="true" android:id="@+id/home" android:layout_width="20.0dip" android:layout_height="match_parent" systemui:keyCode="3" systemui:keyRepeat="false" android:layout_weight="0" systemui:glowBackground="@drawable/ic_sysbar_highlight" android:contentDescription="@string/accessibility_home" />
    </RelativeLayout>

    Here's the code in full:

    Code:
    <com.android.systemui.statusbar.phone.PhoneStatusBarView android:id="@+id/status_bar" android:background="@drawable/system_bar_background" android:orientation="vertical" android:focusable="true" android:descendantFocusability="afterDescendants" android:fitsSystemWindows="true"
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
        <ImageView android:id="@+id/notification_lights_out" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="match_parent" android:paddingStart="6dip" android:paddingBottom="2dip" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:visibility="gone" />
        <LinearLayout android:id="@+id/status_bar_contents" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingStart="6dip" android:paddingEnd="6dip" android:orientation="horizontal" >
            <LinearLayout android:id="@+id/notification_icon_area" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="1" android:orientation="horizontal" >
                <com.android.systemui.statusbar.StatusBarIconView android:id="@+id/moreIcon" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="match_parent" android:src="@drawable/stat_notify_more" android:visibility="gone" />
                <com.android.systemui.statusbar.phone.IconMerger android:id="@+id/notificationIcons" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentStart="true" android:gravity="center_vertical" android:orientation="horizontal"/>  
            </LinearLayout>
            <LinearLayout android:id="@+id/system_icon_area" android:layout_width="wrap_content" android:layout_height="match_parent" android:orientation="horizontal">
                <LinearLayout android:id="@+id/statusIcons" android:layout_width="wrap_content" android:layout_height="match_parent" android:gravity="center_vertical" android:orientation="horizontal"/>    
                <LinearLayout android:id="@+id/signal_battery_cluster" android:layout_width="wrap_content" android:layout_height="match_parent" android:paddingStart="2dp" android:orientation="horizontal" android:gravity="center" >
                    <include layout="@layout/signal_cluster_view" android:id="@+id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <com.android.systemui.BatteryMeterView android:id="@+id/battery" android:layout_height="16dp" android:layout_width="10.5dp" android:layout_marginBottom="0.33dp" android:layout_marginStart="4dip" />
                </LinearLayout>
                <RelativeLayout android:layout_width="wrap_content" android:layout_width="fill_parent">
                    <com.android.systemui.statusbar.policy.Clock android:layout_alignParentRight="true" android:id="@+id/clock" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:layout_width="wrap_content" android:layout_height="match_parent" android:singleLine="true" android:paddingStart="6dip" android:gravity="center_vertical|start" />
                    <com.android.systemui.statusbar.policy.KeyButtonView android:layout_alignParentRight="true" android:id="@+id/home" android:layout_width="20.0dip" android:layout_height="match_parent" systemui:keyCode="3" systemui:keyRepeat="false" android:layout_weight="0" systemui:glowBackground="@drawable/ic_sysbar_highlight" android:contentDescription="@string/accessibility_home" />
                </RelativeLayout>
            </LinearLayout>
        </LinearLayout>
        <LinearLayout android:id="@+id/ticker" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingStart="6dip" android:animationCache="false" android:orientation="horizontal" >
            <ImageSwitcher android:id="@+id/tickerIcon" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:layout_marginEnd="4dip" >
                <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="center" />
                <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="center" />
            </ImageSwitcher>
            <com.android.systemui.statusbar.phone.TickerView android:id="@+id/tickerText" android:layout_width="0dip" android:layout_weight="1" android:layout_height="wrap_content" android:paddingTop="2dip" android:paddingEnd="10dip">
                <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" />
                <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" />
            </com.android.systemui.statusbar.phone.TickerView>
        </LinearLayout>
    </com.android.systemui.statusbar.phone.PhoneStatusBarView>

    I've removed the reference to the image file in the softkey line and changed the width to 20 density-independent pixels. That width may need changing, depending on your personal preference. Too big and there'll be a big gap between the clock and the battery icon. Too small and the softkey will be very hard to tap. Experiment to find the value that works for you.

    By using the RelativeLayout and the 'android:layout_alignParentRight' attribute, I've ensured that the clock and the softkey occupy the same part of the status bar. Because the softkey now has no image file, it's basically invisible.

    Just tap on the clock to go back to the home screen!

    bJjvuXL.png

    (You could use a FrameLayout instead of a RelativeLayout, which would be simpler. But it's worth getting used to how RelativeLayouts work, they can be very useful!)

    Of course, you don't have to put the HOME softkey in your status bar. It could be the MENU softkey, the RECENT APPS softkey, even a POWER or SEARCH softkey if you know how.

    Or you can have more than one in there. Or they can be visible.

    It's your device, you can do what you want.

    Just make sure to make a backup before you start modding though!