[GUIDE][4.2+] Replace your statusbar clock with a styled TextClock

Search This thread

Spannaa

Recognized Contributor / Themer
Sep 13, 2010
7,431
16,793
Cardiff
Huawei Nexus 6P
Google Pixel 6
This guide assumes that you can decompile & recompile apks.

Whilst theming my statusbar clock and running into a couple of smali problems, @Ticklefish suggested I look at TextClock - an extension to TextView that was introduced in Android 4.2

TextClock can display the current time and/or date as a formatted string using both 12-hour and 24-hour modes and makes a great drop-in replacement for the normal statusbar clock.

The statusbar clock code is contained in the com.android.systemui.statusbar.policy.Clock code block in SystemUI.apk\res\layout\status_bar.xml and we can replace this with a TextClock code block:
Code:
<TextClock android:format12Hour="EEE h:mm a" android:format24Hour="EEE HH:mm" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:id="@id/clock" android:paddingLeft="3.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom" android:singleLine="true" />

The important bits here are the format strings:
Code:
android:format12Hour="EEE h:mm a"
which shows as Fri 8:26 PM

Code:
android:format24Hour="EEE HH:mm"
which shows as Fri 20:26

You can use a combination of the options below to create your preferred format:

d.............Day Of Month (single digit) 7
dd.......... Day Of Month (double digit) Zero, 07
EEEE......Day Of Week (Full) Monday
EEE........Week Day (Short) Mon
MMMM....Month (Full) AUGUST
MMM.......Month (Short) AUG
MM..........Month (double digit) 08
M............Month (Single digit) 8
yyyy........Year (Full) 2013
yy............Year (Short) 13
h..............Hour (12 hour, single digit) 8
hh............Hour (12 hour, double digit) 08
H.............Hour (24 hour, single digit) 8 20
HH...........Hour (24 hour, double digit) 08 20 (Note: some roms use kk instead)
m.............Minute (single digit) 9
MM..........Minute (double digit) 09
s..............Second (single digit) 9
ss............Second (double digit) 09
a..............Marker AM/PM

One advantage of using TextClock is that if you move the android:format strings into string resources, you can embed simple HTML into the strings to enhance the result

So replace:
Code:
android:format12Hour="EEE h:mm a" android:format24Hour="EEE HH:mm"

with:
Code:
android:format12Hour="@string/status_bar_clock_12hr_format" android:format24Hour="@string/status_bar_clock_24hr_format"

and add two strings to the bottom of SystemUI.apk\res\values\strings.xml,
Code:
	<string name="status_bar_clock_12hr_format">EEE h:mm a</string>
	<string name="status_bar_clock_24hr_format">EEE HH:mm</string>
these can then be styled using HTML

<b>...</b> ..................................makes the the enclosed text bold
<i>...</i> ...................................makes the the enclosed text italic
<font size ="X">...</font> ............sets the font size of the enclosed text to X.0dip
<font fgcolor ="#ffffffff">...</> ........sets the foreground colour of the enclosed text
<font bgcolor ="#ff000000">...</> .sets the background colour of the enclosed text

Example:
Code:
<string name="status_bar_clock_12hr_format"><font size="12">EEE </font>h:mm<font size="12"> a</font></string>
which shows as
0NIKe6D.png
as the base font size was 18.0dip

Code:
<string name="status_bar_clock_24hr_format"><font size="12">EEE </font>HH:mm</string>
which shows as
wB5v9jA.png
as the base font size was 18.0dip

Other styling is handled normally, either in-line or in an external style resource in SystemUI.apk\res\values\styles.xml
Code:
android:textAppearance="@style/TextAppearance.StatusBar.Clock"

Embedding HTML in string resources will also work in a normal TextView and there are a few additional tags you can use. REFERENCE

Note: Setting android:textAllCaps="true" inline or <item name="android:textAllCaps">true</item> in your external style resource will break the HTML embedded in the XML strings as this HAS to be in lowercase for it to be parsed.
 
Last edited:

Spannaa

Recognized Contributor / Themer
Sep 13, 2010
7,431
16,793
Cardiff
Huawei Nexus 6P
Google Pixel 6
  • Like
Reactions: avirk and _Sale_

glfsd

Senior Member
Jul 31, 2011
586
1,271
www.androidfanzone.forumfree.it
thanks Spannaa, great guide

please a helping hand. where am I doing wrong?


this is my clock line
Code:
<com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="center" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:shadowColor="#ff000000" android:shadowDy="2.0" android:shadowRadius="2.0" />

and I replaced it with
Code:
<TextClock android:format24Hour="@string/status_bar_clock_24hr_format" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="bottom" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:shadowColor="#ff000000" android:shadowDy="2.0" android:shadowRadius="2.0" />

and in strings.xml I added
Code:
	<string name="status_bar_clock_24hr_format">EEE HH:mm</string>

I'd like it to be like your example
wB5v9jA.png


and I wish it was Lun and no lun

ps. sorry for my poor english :eek:
 

Spannaa

Recognized Contributor / Themer
Sep 13, 2010
7,431
16,793
Cardiff
Huawei Nexus 6P
Google Pixel 6
thanks Spannaa, great guide

please a helping hand. where am I doing wrong?


this is my clock line
Code:
<com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="center" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:shadowColor="#ff000000" android:shadowDy="2.0" android:shadowRadius="2.0" />

and I replaced it with
Code:
<TextClock android:format24Hour="@string/status_bar_clock_24hr_format" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="bottom" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:shadowColor="#ff000000" android:shadowDy="2.0" android:shadowRadius="2.0" />

and in strings.xml I added
Code:
	<string name="status_bar_clock_24hr_format">EEE HH:mm</string>

I'd like it to be like your example
wB5v9jA.png


and I wish it was Lun and no lun

ps. sorry for my poor english :eek:

To display the correct hour, try changing the HH to kk (something to do with SimpleDateFormat)

I'm pretty sure that the capitalisation of the day is controlled by your timezone and locale settings so I don't think that's changeable.
 
  • Like
Reactions: avirk and glfsd

glfsd

Senior Member
Jul 31, 2011
586
1,271
www.androidfanzone.forumfree.it
sorry Spannaa, one last thing.
I can not change the font size of the "LUN"


I put it in strings.xml, this
Code:
    <string name="status_bar_clock_24hr_format"><font size="8">EEE </font>kk:mm</string>
is that right? but does not change :(

this is my styles.xml
Code:
    <style name="TextAppearance.StatusBar.Clock" parent="@*android:style/TextAppearance.StatusBar.Icon">
        <item name="android:textSize">16.0dip</item>
        <item name="android:textStyle">normal</item>
        <item name="android:textColor">#ffffffff</item>
    </style>
 

Spannaa

Recognized Contributor / Themer
Sep 13, 2010
7,431
16,793
Cardiff
Huawei Nexus 6P
Google Pixel 6
sorry Spannaa, one last thing.
I can not change the font size of the "LUN"


I put it in strings.xml, this
Code:
    <string name="status_bar_clock_24hr_format"><font size="8">EEE </font>kk:mm</string>
is that right? but does not change :(

this is my styles.xml
Code:
    <style name="TextAppearance.StatusBar.Clock" parent="@*android:style/TextAppearance.StatusBar.Icon">
        <item name="android:textSize">16.0dip</item>
        <item name="android:textStyle">normal</item>
        <item name="android:textColor">#ffffffff</item>
    </style>

Have you capitalised the string in your TextClock xml?

Now you're using HTML in your string, you can't set android:textAllCaps="true" as the embedded HTML has to be in lowercase for it to be parsed.
 
Y

yeshwanthvshenoy

Guest
This guide assumes that you can decompile & recompile apks.

The statusbar clock code is contained in the com.android.systemui.statusbar.policy.Clock code block in SystemUI.apk\res\layout\status_bar.xml and we can replace this with a TextClock code block:
Code:
<TextClock android:format12Hour="@string/status_bar_expanded_clock_12hr_format" android:format24Hour="@string/status_bar_expanded_clock_24hr_format" android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Clock" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom" android:layout_marginTop="-3.0dip" android:layout_marginLeft="@dimen/notification_panel_header_clock_margin_left" android:singleLine="true" />

sir this is the error i get :

Code:
I: Building resources...
C:\apktool\systemui\res\layout\status_bar.xml:19: error: Error: No resource foun
d that matches the given name (at 'layout_marginLeft' with value '@dimen/notific
ation_panel_header_clock_margin_left').
aapt: warning: string 'compat_mode_help_body' has no default translation in C:\a
pktool\systemui\res; found: et hy ka km lo ms
aapt: warning: string 'compat_mode_help_header' has no default translation in C:
\apktool\systemui\res; found: et hy ka km lo ms
aapt: warning: string 'done_button' has no default translation in C:\apktool\sys
temui\res; found: mn
aapt: warning: string 'jelly_bean_dream_name' has no default translation in C:\a
pktool\systemui\res; found: et hy ka km lo mn ms
aapt: warning: string 'quick_settings_wifi_display_label' has no default transla
tion in C:\apktool\systemui\res; found: et hy ka km lo mn ms
aapt: warning: string 'quick_settings_wifi_display_no_connection_label' has no d
efault translation in C:\apktool\systemui\res; found: et hy ka km lo mn ms
aapt: warning: string 'ssl_ca_cert_dialog_title' has no default translation in C
:\apktool\systemui\res; found: mn
aapt: warning: string 'ssl_ca_cert_info_message' has no default translation in C
:\apktool\systemui\res; found: mn
aapt: warning: string 'ssl_ca_cert_settings_button' has no default translation i
n C:\apktool\systemui\res; found: mn
aapt: warning: string 'ssl_ca_cert_warning_message' has no default translation i
n C:\apktool\systemui\res; found: mn
aapt: warning: string 'status_bar_help_text' has no default translation in C:\ap
ktool\systemui\res; found: et hy ka km lo mn ms
aapt: warning: string 'status_bar_help_title' has no default translation in C:\a
pktool\systemui\res; found: et hy ka km lo mn ms
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.Androl
ibException: brut.common.BrutException: could not exec command: [aapt, p, --min-
sdk-version, 19, --target-sdk-version, 19, -F, C:\Users\Home\AppData\Local\Temp\
APKTOOL2380618344831959179.tmp, -I, C:\Users\Home\apktool\framework\1.apk, -S, C
:\apktool\systemui\res, -M, C:\apktool\systemui\AndroidManifest.xml]
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:358)
        at brut.androlib.Androlib.buildResources(Androlib.java:283)
        at brut.androlib.Androlib.build(Androlib.java:206)
        at brut.androlib.Androlib.build(Androlib.java:176)
        at brut.apktool.Main.cmdBuild(Main.java:228)
        at brut.apktool.Main.main(Main.java:79)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not
 exec command: [aapt, p, --min-sdk-version, 19, --target-sdk-version, 19, -F, C:
\Users\Home\AppData\Local\Temp\APKTOOL2380618344831959179.tmp, -I, C:\Users\Home
\apktool\framework\1.apk, -S, C:\apktool\systemui\res, -M, C:\apktool\systemui\A
ndroidManifest.xml]
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:357)
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:336)
        ... 5 more
Caused by: brut.common.BrutException: could not exec command: [aapt, p, --min-sd
k-version, 19, --target-sdk-version, 19, -F, C:\Users\Home\AppData\Local\Temp\AP
KTOOL2380618344831959179.tmp, -I, C:\Users\Home\apktool\framework\1.apk, -S, C:\
apktool\systemui\res, -M, C:\apktool\systemui\AndroidManifest.xml]
        at brut.util.OS.exec(OS.java:89)
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:355)
        ... 6 more

C:\apktool>

all i did was replaced the clock line with :

Code:
<TextClock android:format12Hour="EEE h:mm a" android:format24Hour="EEE HH:mm" android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Clock" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom" android:layout_marginTop="-3.0dip" android:layout_marginLeft="@dimen/notification_panel_header_clock_margin_left" android:singleLine="true" />
 
Last edited:

Spannaa

Recognized Contributor / Themer
Sep 13, 2010
7,431
16,793
Cardiff
Huawei Nexus 6P
Google Pixel 6
sir this is the error i get...


all i did was replaced the clock line with :

Code:
<TextClock android:format12Hour="EEE h:mm a" android:format24Hour="EEE HH:mm" android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Clock" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom" android:layout_marginTop="-3.0dip" android:layout_marginLeft="@dimen/notification_panel_header_clock_margin_left" android:singleLine="true" />

No need to quote the whole of the first post ;)

There's only one error in your log, the rest are warnings.
C:\apktool\systemui\res\layout\status_bar.xml:19: error: Error: No resource found that matches the given name (at 'layout_marginLeft' with value '@dimen/notification_panel_header_clock_margin_left').
which tells you that there is no value called "notification_panel_header_clock_margin_left" in SystemUI.apk\res\values\dimens.xml
so you either need to add this dimen to dimens.xml
Code:
<dimen name="notification_panel_header_clock_margin_left">4.0dip</dimen>
or change the TextClock xml from
Code:
android:layout_marginLeft="@dimen/notification_panel_header_clock_margin_left"
to
Code:
android:layout_marginLeft="4.0dip"
 
  • Like
Reactions: avirk and engloa

Ticklefish

Inactive Recognized Themer
Oct 27, 2011
6,773
8,633
Hampshire, UK
sir this is the error i get :

Code:
I: Building resources...
C:\apktool\systemui\res\layout\status_bar.xml:19: error: Error: No resource foun
d that matches the given name (at 'layout_marginLeft' with value '@dimen/notific
ation_panel_header_clock_margin_left').
aapt: warning: string 'compat_mode_help_body' has no default translation in C:\a
pktool\systemui\res; found: et hy ka km lo ms
aapt: warning: string 'compat_mode_help_header' has no default translation in C:
\apktool\systemui\res; found: et hy ka km lo ms
aapt: warning: string 'done_button' has no default translation in C:\apktool\sys
temui\res; found: mn
aapt: warning: string 'jelly_bean_dream_name' has no default translation in C:\a
pktool\systemui\res; found: et hy ka km lo mn ms
aapt: warning: string 'quick_settings_wifi_display_label' has no default transla
tion in C:\apktool\systemui\res; found: et hy ka km lo mn ms
aapt: warning: string 'quick_settings_wifi_display_no_connection_label' has no d
efault translation in C:\apktool\systemui\res; found: et hy ka km lo mn ms
aapt: warning: string 'ssl_ca_cert_dialog_title' has no default translation in C
:\apktool\systemui\res; found: mn
aapt: warning: string 'ssl_ca_cert_info_message' has no default translation in C
:\apktool\systemui\res; found: mn
aapt: warning: string 'ssl_ca_cert_settings_button' has no default translation i
n C:\apktool\systemui\res; found: mn
aapt: warning: string 'ssl_ca_cert_warning_message' has no default translation i
n C:\apktool\systemui\res; found: mn
aapt: warning: string 'status_bar_help_text' has no default translation in C:\ap
ktool\systemui\res; found: et hy ka km lo mn ms
aapt: warning: string 'status_bar_help_title' has no default translation in C:\a
pktool\systemui\res; found: et hy ka km lo mn ms
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.Androl
ibException: brut.common.BrutException: could not exec command: [aapt, p, --min-
sdk-version, 19, --target-sdk-version, 19, -F, C:\Users\Home\AppData\Local\Temp\
APKTOOL2380618344831959179.tmp, -I, C:\Users\Home\apktool\framework\1.apk, -S, C
:\apktool\systemui\res, -M, C:\apktool\systemui\AndroidManifest.xml]
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:358)
        at brut.androlib.Androlib.buildResources(Androlib.java:283)
        at brut.androlib.Androlib.build(Androlib.java:206)
        at brut.androlib.Androlib.build(Androlib.java:176)
        at brut.apktool.Main.cmdBuild(Main.java:228)
        at brut.apktool.Main.main(Main.java:79)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not
 exec command: [aapt, p, --min-sdk-version, 19, --target-sdk-version, 19, -F, C:
\Users\Home\AppData\Local\Temp\APKTOOL2380618344831959179.tmp, -I, C:\Users\Home
\apktool\framework\1.apk, -S, C:\apktool\systemui\res, -M, C:\apktool\systemui\A
ndroidManifest.xml]
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:357)
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:336)
        ... 5 more
Caused by: brut.common.BrutException: could not exec command: [aapt, p, --min-sd
k-version, 19, --target-sdk-version, 19, -F, C:\Users\Home\AppData\Local\Temp\AP
KTOOL2380618344831959179.tmp, -I, C:\Users\Home\apktool\framework\1.apk, -S, C:\
apktool\systemui\res, -M, C:\apktool\systemui\AndroidManifest.xml]
        at brut.util.OS.exec(OS.java:89)
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:355)
        ... 6 more

C:\apktool>

all i did was replaced the clock line with :

Code:
<TextClock android:format12Hour="EEE h:mm a" android:format24Hour="EEE HH:mm" android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Clock" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom" android:layout_marginTop="-3.0dip" android:layout_marginLeft="@dimen/notification_panel_header_clock_margin_left" android:singleLine="true" />

Please don't quote the entire OP. It's one of the few cardinal sins in xda as it clutters up the screen and makes reading threads a nightmare. :eek:

Anyway, your error is basically this:

Code:
C:\apktool\systemui\res\layout\status_bar.xml:19: error: Error: No resource foun
d that matches the given name (at 'layout_marginLeft' with value '@dimen/notific
ation_panel_header_clock_margin_left').

There's also some translation warnings which you can safely ignore and a load of aapt error messages which you can ignore as well. Once you get the hang of reading compiling errors like these, you'll realise that they do actually give you enough information to fix the issue.

Your apk won't recompile because you don't have a dimension called 'notific
ation_panel_header_clock_margin_left
'. You can either edit your dimens.xml to put it in or it might be easier to just delete that attribute:

Code:
<TextClock android:format12Hour="EEE h:mm a" android:format24Hour="EEE HH:mm" android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Clock" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom" android:layout_marginTop="-3.0dip" android:singleLine="true" />


---------- Post added at 05:34 PM ---------- Previous post was at 05:31 PM ----------

No need to quote the whole of the first post ;)

There's only one error in your log, the rest are warnings.

which tells you that there is no value called "notification_panel_header_clock_margin_left" in SystemUI.apk\res\values\dimens.xml
so you either need to add this dimen to dimens.xml
Code:
<dimen name="notification_panel_header_clock_margin_left">4.0dip</dimen>
or change the TextClock xml from
Code:
android:layout_marginLeft="@dimen/notification_panel_header_clock_margin_left"
to
Code:
android:layout_marginLeft="4.0dip"

You beat my reply by six whole minutes. Sigh...you're just too fast for me! :cool:
 

Huncriter

Senior Member
Aug 24, 2011
111
13
I'll need a lot more detail than that if you need help ;)

Post your TextClock code and any associated lines from strings.xml styles.xml and dimens.xml

Sent from my GT-I9300...

this is my code
Code:
<TextClock android:format12Hour="EEE h:mm a" android:format24Hour="EEE HH:mm" android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Clock" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom" android:layout_marginTop="-3.0dip" android:singleLine="true" />

styles.xml
Code:
<style name="TextAppearance.StatusBar.Expanded.Clock" parent="@style/TextAppearance.StatusBar.Expanded">
        <item name="android:textSize">32.0dip</item>
        <item name="android:textStyle">normal</item>
        <item name="android:textColor">#ffffffff</item>
        <item name="android:fontFamily">sans-serif-light</item>
    </style>
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 46
    This guide assumes that you can decompile & recompile apks.

    Whilst theming my statusbar clock and running into a couple of smali problems, @Ticklefish suggested I look at TextClock - an extension to TextView that was introduced in Android 4.2

    TextClock can display the current time and/or date as a formatted string using both 12-hour and 24-hour modes and makes a great drop-in replacement for the normal statusbar clock.

    The statusbar clock code is contained in the com.android.systemui.statusbar.policy.Clock code block in SystemUI.apk\res\layout\status_bar.xml and we can replace this with a TextClock code block:
    Code:
    <TextClock android:format12Hour="EEE h:mm a" android:format24Hour="EEE HH:mm" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:id="@id/clock" android:paddingLeft="3.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom" android:singleLine="true" />

    The important bits here are the format strings:
    Code:
    android:format12Hour="EEE h:mm a"
    which shows as Fri 8:26 PM

    Code:
    android:format24Hour="EEE HH:mm"
    which shows as Fri 20:26

    You can use a combination of the options below to create your preferred format:

    d.............Day Of Month (single digit) 7
    dd.......... Day Of Month (double digit) Zero, 07
    EEEE......Day Of Week (Full) Monday
    EEE........Week Day (Short) Mon
    MMMM....Month (Full) AUGUST
    MMM.......Month (Short) AUG
    MM..........Month (double digit) 08
    M............Month (Single digit) 8
    yyyy........Year (Full) 2013
    yy............Year (Short) 13
    h..............Hour (12 hour, single digit) 8
    hh............Hour (12 hour, double digit) 08
    H.............Hour (24 hour, single digit) 8 20
    HH...........Hour (24 hour, double digit) 08 20 (Note: some roms use kk instead)
    m.............Minute (single digit) 9
    MM..........Minute (double digit) 09
    s..............Second (single digit) 9
    ss............Second (double digit) 09
    a..............Marker AM/PM

    One advantage of using TextClock is that if you move the android:format strings into string resources, you can embed simple HTML into the strings to enhance the result

    So replace:
    Code:
    android:format12Hour="EEE h:mm a" android:format24Hour="EEE HH:mm"

    with:
    Code:
    android:format12Hour="@string/status_bar_clock_12hr_format" android:format24Hour="@string/status_bar_clock_24hr_format"

    and add two strings to the bottom of SystemUI.apk\res\values\strings.xml,
    Code:
    	<string name="status_bar_clock_12hr_format">EEE h:mm a</string>
    	<string name="status_bar_clock_24hr_format">EEE HH:mm</string>
    these can then be styled using HTML

    <b>...</b> ..................................makes the the enclosed text bold
    <i>...</i> ...................................makes the the enclosed text italic
    <font size ="X">...</font> ............sets the font size of the enclosed text to X.0dip
    <font fgcolor ="#ffffffff">...</> ........sets the foreground colour of the enclosed text
    <font bgcolor ="#ff000000">...</> .sets the background colour of the enclosed text

    Example:
    Code:
    <string name="status_bar_clock_12hr_format"><font size="12">EEE </font>h:mm<font size="12"> a</font></string>
    which shows as
    0NIKe6D.png
    as the base font size was 18.0dip

    Code:
    <string name="status_bar_clock_24hr_format"><font size="12">EEE </font>HH:mm</string>
    which shows as
    wB5v9jA.png
    as the base font size was 18.0dip

    Other styling is handled normally, either in-line or in an external style resource in SystemUI.apk\res\values\styles.xml
    Code:
    android:textAppearance="@style/TextAppearance.StatusBar.Clock"

    Embedding HTML in string resources will also work in a normal TextView and there are a few additional tags you can use. REFERENCE

    Note: Setting android:textAllCaps="true" inline or <item name="android:textAllCaps">true</item> in your external style resource will break the HTML embedded in the XML strings as this HAS to be in lowercase for it to be parsed.
    5
    Nice work Spannaa :thumbup:

    Sent from my GT-I9100 using Tapatalk 2
    4
    Guys, I just want to make this one to be so sure before I do it.

    in my status_bar.xml 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" />


    So, i just delete that line of code and replace with this one, right?

    Wrong. ;)

    To quote myself from the other thread..

    Ticklefish said:
    So all you'd need to do is hide the current clock (don't delete the line!) and add a line of code that looks something like this:

    I could go into some detail about why but basically never delete a line with an '@id' in it. You need to hide your clock instead of deleting it. The easiest way to do that is to add another attribute:

    Code:
    <com.android.systemui.statusbar.policy.Clock [B][COLOR="Red"]android:visibility="gone"[/COLOR][/B] 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" />
    3
    Great guide mate. Just missed the 4.1+ version. ;)
    3
    sorry Spannaa, one last thing.
    I can not change the font size of the "LUN"


    I put it in strings.xml, this
    Code:
        <string name="status_bar_clock_24hr_format"><font size="8">EEE </font>kk:mm</string>
    is that right? but does not change :(

    this is my styles.xml
    Code:
        <style name="TextAppearance.StatusBar.Clock" parent="@*android:style/TextAppearance.StatusBar.Icon">
            <item name="android:textSize">16.0dip</item>
            <item name="android:textStyle">normal</item>
            <item name="android:textColor">#ffffffff</item>
        </style>

    Have you capitalised the string in your TextClock xml?

    Now you're using HTML in your string, you can't set android:textAllCaps="true" as the embedded HTML has to be in lowercase for it to be parsed.