[GUIDE][05 AUG] How To Make Lock Screen Clock Allign To Center in Jellybean and ICS

Search This thread

baldypal

Senior Member
Dec 10, 2010
55
16
Midland
Did anyone got it working with dpi other than default? For me it works only with default DPI(240) but not with custom DPI like 200.

Sent from my GT-I9100 using xda premium

I tried this last night, changing the margin to 52 (didn't move), and then to 62 (notice some movement). Was going to try 72 but then it was already midnight. Had to get some rest.
 

Attachments

  • Screenshot_2012-08-16-09-39-03.jpg
    Screenshot_2012-08-16-09-39-03.jpg
    22.6 KB · Views: 294

MyLifeRocks10

Senior Member
Mar 8, 2012
3,883
9,843
I tried this last night, changing the margin to 52 (didn't move), and then to 62 (notice some movement). Was going to try 72 but then it was already midnight. Had to get some rest.

Is that on custom dpi or default dpi? It works on default dpi which is 240 for S2 but in custom dpi like 200 i don't see any visual changes.

Sent from my GT-I9100 using xda premium
 
isn't changing the layout a way better method?

frameworks / base / core / res / res /layout / keyguard_screen_tab_unlock.xml

(for the decompile guys / res /layout / keyguard_screen_tab_unlock.xml)
i did not test this btw but i think this is much cleaner then changing the margin

Code:
<GridLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/root"
    android:gravity="center_horizontal">

    <com.android.internal.widget.DigitalClock android:id="@+id/time"
        android:layout_marginTop="@dimen/keyguard_lockscreen_status_line_clockfont_top_margin"
        android:layout_marginBottom="12dip"
-        android:layout_marginRight="@dimen/keyguard_lockscreen_status_line_font_right_margin"
-        android:layout_gravity="right">
+        android:layout_gravity="center">

        <!-- Because we can't have multi-tone fonts, we render two TextViews, one on
        top of the other. Hence the redundant layout... -->
        <TextView android:id="@+id/timeDisplayBackground"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:singleLine="true"
            android:ellipsize="none"
            android:textSize="@dimen/keyguard_lockscreen_clock_font_size"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:layout_marginBottom="6dip"
            android:textColor="@color/lockscreen_clock_background"
            />

        <TextView android:id="@+id/timeDisplayForeground"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:singleLine="true"
            android:ellipsize="none"
            android:textSize="@dimen/keyguard_lockscreen_clock_font_size"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:layout_marginBottom="6dip"
            android:textColor="@color/lockscreen_clock_foreground"
            android:layout_alignLeft="@id/timeDisplayBackground"
            android:layout_alignTop="@id/timeDisplayBackground"
            />

    </com.android.internal.widget.DigitalClock>

    <LinearLayout
        android:orientation="horizontal"
-        android:layout_gravity="right"
-        android:layout_marginRight="@dimen/keyguard_lockscreen_status_line_font_right_margin">
+        android:layout_gravity="center">

        <TextView
            android:id="@+id/date"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:singleLine="true"
            android:ellipsize="marquee"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
            />

        <TextView
            android:id="@+id/alarm_status"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="16dip"
            android:singleLine="true"
            android:ellipsize="marquee"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
            android:drawablePadding="4dip"
            />

    </LinearLayout>

    <TextView
        android:id="@+id/status1"
-        android:layout_gravity="right"
+        android:layout_gravity="center"
-        android:layout_marginRight="@dimen/keyguard_lockscreen_status_line_font_right_margin"
        android:singleLine="true"
        android:ellipsize="marquee"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
        android:drawablePadding="4dip"
        />

Oh yeah, much better! Thank you!
cfa0ea82-ff09-c0a1.jpg


DarkJelly Gnex on JellyBro sent this from the app.
 
  • Like
Reactions: Jleeblanch

Senthamil

Senior Member
Jun 24, 2012
136
38
Chennai
Hi,
I want to display the seconds on the status bar clock. Does anybody have any idea or method on how to do this.....?
thanks.
 

Jleeblanch

Senior Member
Feb 6, 2012
2,024
5,740
Colchester, VT
Moto G4 Plus
Moto G6
Thanks for the Tutorial! Just decompiled/recompiled and had success!! Had to play with it to get it right! Then I decided to read the entire thread and came across the other way of doing it lol... guess I'm decompiling/recompiling again!
Much appreciate the work peeps! I'll make sure I send credits this way when I post the mod in my forum section! :cool:

Sent from my MB855 using Tapatalk 2
 

F4M0U569

Senior Member
Dec 10, 2011
574
142
Does this even work? I tried it on my HOX and it didnt changed anything. It was set to 66.0 running at 260dpi. I decompiled and compiled with no problem.
 

icke

Senior Member
Feb 12, 2007
2,002
1,202
Ahaus
Google Pixel 6
I've written a guide on how to fix that issue for S2 but it may work with other devices too. Link
This will work on hdpi devices....but not on xhdpi. When U try your method on xhdpi the unlock ring is off centered on standard dpi (320) because on lowered dpi on a xhdpi device, rom is trying to use hdpi drawable...but there are none of these file. So U have to grabb these files from a hdpi rom and place these in framework from your xhdpi rom.

Further U have to edit also dimens.xml and then it is working on all dpi on a xhdpi device.
 
This will work on hdpi devices....but not on xhdpi. When U try your method on xhdpi the unlock ring is off centered on standard dpi (320) because on lowered dpi on a xhdpi device, rom is trying to use hdpi drawable...but there are none of these file. So U have to grabb these files from a hdpi rom and place these in framework from your xhdpi rom.

Further U have to edit also dimens.xml and then it is working on all dpi on a xhdpi device.

Edit:
Oh nvm your talking about that link not this thread...Lol

DarkJelly Gnex on JellyBro sent this from the app.
 
Last edited:

vaibhav palande

Senior Member
Jan 27, 2012
293
111
Pune
i couldnt get it to work.. steps m following are....

1. decompile framework-res.apk
2. Make changes
3. Save the changes
4. Recompile apk
5. move resources.arsc to original apk from newly compiled apk.
6. ADB push apk to system.
7. Set the correct permissions (644, rw-r-r) from root explorer.
8. Reboot

After rebooting m stuck on the boot animation, nothing happens after that. I have to restore my backup through CWM.

M i doing anything wrong? Any help will b really appreciated.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 30
    ABOUT :
    This is a easy guide which will teach you how to make the Lockscreen Clock Allign To Center

    SCREENSHOT :


    STEPS :
    1. Extract the "framework-res.apk" from ROM
    2. Decompile it using apktool
    3. Browse To "\res\values" and open dimens.xml
    4. Find These Lines
    Code:
    <dimen name="keyguard_lockscreen_clock_font_size">80.0dip</dimen>
    <dimen name="keyguard_lockscreen_status_line_font_size">14.0dip</dimen>
    <dimen name="keyguard_lockscreen_status_line_font_right_margin">42.0dip</dimen><dimen name="keyguard_lockscreen_status_line_clockfont_top_margin">22.0dip</dimen>
    <dimen name="keyguard_lockscreen_status_line_clockfont_bottom_margin">12.0dip</dimen>
    <dimen name="keyguard_lockscreen_pin_margin_left">40.0dip</dimen>

    5. You basically need to edit

    <dimen name="keyguard_lockscreen_status_line_font_right_margin">52.0dip</dimen> - Necessary ( Sets Margin from Right which basically alligns to center )
    <dimen name="keyguard_lockscreen_clock_font_size">85.0dip</dimen> - Not Necessary ( Sets the font size of clock time display)
    <dimen name="keyguard_lockscreen_status_line_clockfont_top_margin">22.0dip</dimen> - Not Necessary ( Sets Margin From Top )
    <dimen name="keyguard_lockscreen_status_line_clockfont_bottom_margin">12.0dip</dimen> - Not Necessary ( Sets Margin From Bottom )

    6. Assuming that you have a WVGA device. Without a thought do this
    Code:
    <dimen name="keyguard_lockscreen_status_line_font_right_margin">[B]52.0dip[/B]</dimen>
    <dimen name="keyguard_lockscreen_clock_font_size">[B]85.0dip[/B]</dimen>

    What I did is changed the font size to 85 dip and right margin to 52 dip. You can see the result in screenshot above

    7. If you have a device with different resolution. You need to do some experiment on your own by changing margin to allign it in center.
    I will suggest to keep the right allign to 54-56 dip and font size 82 dip for devices with higher resolution above 480*800

    8. Thats All.. If you want too change layout to bottom or extreme top..Change te dip values for top and bottom margin

    For more tutorials and guides visit - www.blindndumb.com
    Cheers :)
    3
    isn't changing the layout a way better method?

    frameworks / base / core / res / res /layout / keyguard_screen_tab_unlock.xml

    (for the decompile guys / res /layout / keyguard_screen_tab_unlock.xml)
    i did not test this btw but i think this is much cleaner then changing the margin

    Code:
    <GridLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/root"
        android:gravity="center_horizontal">
    
        <com.android.internal.widget.DigitalClock android:id="@+id/time"
            android:layout_marginTop="@dimen/keyguard_lockscreen_status_line_clockfont_top_margin"
            android:layout_marginBottom="12dip"
    -        android:layout_marginRight="@dimen/keyguard_lockscreen_status_line_font_right_margin"
    -        android:layout_gravity="right">
    +        android:layout_gravity="center">
    
            <!-- Because we can't have multi-tone fonts, we render two TextViews, one on
            top of the other. Hence the redundant layout... -->
            <TextView android:id="@+id/timeDisplayBackground"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:singleLine="true"
                android:ellipsize="none"
                android:textSize="@dimen/keyguard_lockscreen_clock_font_size"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:layout_marginBottom="6dip"
                android:textColor="@color/lockscreen_clock_background"
                />
    
            <TextView android:id="@+id/timeDisplayForeground"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:singleLine="true"
                android:ellipsize="none"
                android:textSize="@dimen/keyguard_lockscreen_clock_font_size"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:layout_marginBottom="6dip"
                android:textColor="@color/lockscreen_clock_foreground"
                android:layout_alignLeft="@id/timeDisplayBackground"
                android:layout_alignTop="@id/timeDisplayBackground"
                />
    
        </com.android.internal.widget.DigitalClock>
    
        <LinearLayout
            android:orientation="horizontal"
    -        android:layout_gravity="right"
    -        android:layout_marginRight="@dimen/keyguard_lockscreen_status_line_font_right_margin">
    +        android:layout_gravity="center">
    
            <TextView
                android:id="@+id/date"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:singleLine="true"
                android:ellipsize="marquee"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
                />
    
            <TextView
                android:id="@+id/alarm_status"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="16dip"
                android:singleLine="true"
                android:ellipsize="marquee"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
                android:drawablePadding="4dip"
                />
    
        </LinearLayout>
    
        <TextView
            android:id="@+id/status1"
    -        android:layout_gravity="right"
    +        android:layout_gravity="center"
    -        android:layout_marginRight="@dimen/keyguard_lockscreen_status_line_font_right_margin"
            android:singleLine="true"
            android:ellipsize="marquee"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
            android:drawablePadding="4dip"
            />
    1
    anyway you could make this into a flashable zip?
    1
    Hi,
    I tried and got the same error as Magnumutz.

    Copied framework-res.apk on PC, decomplied, opened (with notepad++) dimen.xml from \res\values folder, modified the values.

    Now I'm not able to compile, since the error occurs.
    Tried many version of apktool.

    Can anyone help me to sort this......?

    Use apk manager or apk multitool to compile.

    DarkJelly Gnex on JellyBro sent this from the app.
    1
    Hi,
    I tried and got the same error as Magnumutz.

    Copied framework-res.apk on PC, decomplied, opened (with notepad++) dimen.xml from \res\values folder, modified the values.

    Now I'm not able to compile, since the error occurs.
    Tried many version of apktool.

    Can anyone help me to sort this......?

    For those receiving the same error as Magnumutz, i just got mine to work. i am using apktool and i had to copy the aapt.exe file to the C:\WINDOWS folder. Then it worked.

    Credit to powerpoint45 on this thread see step #2.
    http://xdaforums.com/showthread.php?t=1814441