How To Center The Clock On The Statusbar And Move Other Icons

I'm Not Developer, This Tickle My Android v5.4 Application's credits by Ticklefish
Original Post Was http://forum.xda-developers.com/showthread.php?p=28643215 and i'm just sharing. Many Thanks to Ticklefish

You must have Tickle My Android v5.4  Look on this section


How To Center The Clock On The Statusbar And Move Other Icons


This is a TICKLEFISH TUTORIAL!

We will share information about the Games Android. By following the instructions and guidelines that we provide, you can have an apk apps application,Download Apk Full Android App the latest app that can make you feel comforted.Of course you have to download to have an android apps Free Full is.


Centering the clock on the statusbar is easy. Stopping it from clashing with other things is a little bit harder.

I originally posted here with a long method of fixing this. The problem was, although it worked, it worked for my particular requirements and my particular resolution. Since then I've found a few different ways of doing it and doing it better.

Previously I posted here with four Methods to center the clock. Each one was slightly harder to do than the previous one but was slightly better. After working out the fourth Method, I realised that two of the others were a little redundant and were just causing confusion.

So I've rewritten this post again. Again. This is now the perfect way to center the clock in the statusbar and anybody can do it if they know how. So read on to find out how!

To begin, we need to decompile SystemUI.apk. I would suggest using Tickle My Android, a decompiling tool which has won international acclaim and which can be found at tinyurl.com/ticklemyandroid.

Once you've decompiled the apk, edit res\layout\status_bar.xml
I suggest using Notepad++ for this but you can even use just ordinary Notepad if you're feeling brave.

I'm going to show you to properly center the clock using the xml found in stock Sony Timescape ICS but the principles can be applied to pretty much any rom on any device.

This is the stock code:



Quote:





xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">


























Busy, isn't it? Well, don't worry. Most of the code we can leave untouched. All we care about is this bit:



Quote:






















This is the "@id/icons" LinearLayout, which contains all the icons we normally see on the statusbar, and the first line of the "@id/ticker" LinearLayout, which is all about the notification text. This sort of setup will be on most, if not all roms.

Found out where those bits are? Well, let's do this thing!

The Simple Method

This was first pointed out to me by serajr, so big thanks to him. Method 1 is very simple and very quick and is very easy to do if you've never edited Android xml before.

First, we take the clock and put it in the first line before the "@id/icons" LinearLayout. We need to do this because centering anything in a LinearLayout is possible, but a little complicated..as you'll see in Method 2

We'll need to change the width of the space the clock goes into and the positioning within it. Or, in other words, we need to do this:



Quote:

















All the contents of the "@id/icons" LinearLayout are pushed out of the top of the screen when a notification comes in..but the clock now isn't part of that, so it won't and we get overlapping.
To fix this, we need to add a background to the "@id/ticker" LinearLayout. This will cover up the clock when there's a new notification and we get no overlapping. We'll use the same background as the normal statusbar, defined at the top of the xml, but you could make it anything if you want to be artistic.
So the new code looks like this:



Quote:


















This is very quick to do but it doesn't work with a transparent statusbar, since the background would be then transparent and won't blank out the clock. Plus, if you want to be fussy, it's not quite a perfect fix as the clock doesn't actually move and the other icons do which can look a little strange.

So that's why there's a second Method we could use instead..

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 statusbar so you can move anything anywhere.

This method splits the icons LinearLayout into three unique areas, making it very easy to decide what you want where.

What we do is we use this basic layout:



Quote:







HERE GOES ALL THE CODES FOR THE ITEMS ON THE LEFT SIDE OF THE STATUSBAR



HERE GOES THE CODE FOR THE ITEM IN THE CENTER OF THE STATUSBAR





HERE GOES ALL THE CODES FOR THE ITEMS ON THE RIGHT SIDE OF THE STATUSBAR


Make sense? No? Well, don't worry. There is a logic behind all this. Just take your time, read the code and you'll slowly being to see what it all means.
When I started modding Android, I had no idea at all what any of it meant!

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



Quote:






















You need to adjust some of the parameters on some of the lines to get it all to work but otherwise it's actually all pretty simple.

And that's it. Those are the two methods. Hopefully this will give you a better understanding of what all this code actually means and put you on the road to creating your own mods.

Now you need to save the file and recompile the app. Depending on which tool you're using to recompile, you may need to do something else to let the app work on your phone (this is the "Prepare System App For Pushing" option in Tickle My Android, by the way). Push it or flash it back to your phone...and enjoy!

View the original article here

How To Center The Clock On The Statusbar And Move Other Icons How To Center The Clock On The Statusbar And Move Other Icons Reviewed by Pakar Pupuk Tanaman on May 09, 2013 Rating: 5

No comments:

Powered by Blogger.