Attachments
Last edited:
Are you able to explain how to add a date to the analog clock (e.g. day of the month) and also maybe the month (e.g. Jul for July)
Thanks in advance!
Hi Naheel,
I've tried adding the date but without any luck. Nothing is showing up on the watchface. Do I have to add some other code to include the new XML as part of the build? Will the date show above the watch background image or is there the chance that it is on the bottom layer? Also I'm guessing that the text will be white as per the sample code you posted. Any help is appreciated!
<include layout="@layout/analog_clock_hand_seconds"
android:gravity="left"
android:layout_marginTop="82px"
android:layout_marginLeft="70px"
android:layout_width="45px"
android:layout_height="45px"
/>
I've been busy making new analog watchfaces and figured out how to offset the dials. Edit the code within \res\layout\clock_widget_analog.xml
How to offset dials
As an example the following code will use a square second hands PNG file, resize it to 45x45px and offset it 82px from the top and 70px from the left. It will continue to rotate around the centre of the PNG file (i.e. around pixel x=23,y=23)
Code:<include layout="@layout/analog_clock_hand_seconds" android:gravity="left" android:layout_marginTop="82px" android:layout_marginLeft="70px" android:layout_width="45px" android:layout_height="45px" />
Hi Naheel,
I've found a slight bug in the 'date' code you've shared. It cuts off the second digit for double-digit dates for some reason. For the moment I've only found an inelegant hackers way to fix the problem so I won't share my solution. Not sure if you have a better way of fixing it?
Cheers,
Julian
widgets:template="dd"
<com.sonyericsson.extras.liveware.aef.widget.TimeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<com.sonyericsson.extras.liveware.aef.widget.TimeView
android:layout_width="25px"
android:layout_height="20px"
android:gravity="center"
android:includeFontPadding="false"
android:textColor="@android:color/black"
widgets:textSize="20px"
widgets:timeType="[COLOR="Red"]days_of_month_digit1[/COLOR]" />
<com.sonyericsson.extras.liveware.aef.widget.TimeView
android:layout_width="25px"
android:layout_height="20px"
android:gravity="center"
android:includeFontPadding="false"
android:textColor="@android:color/black"
widgets:textSize="20px"
widgets:timeType="[COLOR="Red"]days_of_month_digit2[/COLOR]" />
</com.sonyericsson.extras.liveware.aef.widget.TimeLayout>
<?xml version="1.0" encoding="utf-8"?>
<!-- Defines the most significant minute number using a level-list of drawables
that can be referenced when creating clocks. -->
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:string="@string/min_digit_0" />
...
</level-list>
Again many thanks for your detailed tutorial, Naheel!
Here is my cyan watchface
Hello, thanks for the watch face but it comes up like the image.
Great tutorial .
Has anyone tried to create a watchface using a string level-list? The Sony clock tutorial implies you can create a levelist a little like:
Code:<?xml version="1.0" encoding="utf-8"?> <!-- Defines the most significant minute number using a level-list of drawables that can be referenced when creating clocks. --> <level-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:string="@string/min_digit_0" /> ... </level-list>
However, Eclipse will throw an error with the use of "android:string". I have tried saving the above XML in the drawable-nodpi folder and had added the appropriate string entries in the strings.xml file.
Any ideas?
<?xml version="1.0" encoding="utf-8"?>
<!-- Defines the least significant hour number using a level-list of drawables
that can be referenced when creating clocks. -->
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:text="one" android:textSize="20px" />
<item android:text="two" android:textSize="20px" />
<item android:text="three" android:textSize="20px" />
<item android:text="four" android:textSize="20px" />
<item android:text="five" android:textSize="20px" />
<item android:text="six" android:textSize="20px" />
<item android:text="seven" android:textSize="20px" />
<item android:text="eight" android:textSize="20px" />
<item android:text="nine" android:textSize="20px" />
<item android:text="ten" android:textSize="20px" />
<item android:text="eleven" android:textSize="20px" />
<item android:text="twelve" android:textSize="20px" />
</level-list>
I've been busy making new analog watchfaces and figured out how to offset the dials. Edit the code within \res\layout\clock_widget_analog.xml
How to offset dials
As an example the following code will use a square second hands PNG file, resize it to 45x45px and offset it 82px from the top and 70px from the left. It will continue to rotate around the centre of the PNG file (i.e. around pixel x=23,y=23)
Code:<include layout="@layout/analog_clock_hand_seconds" android:gravity="left" android:layout_marginTop="82px" android:layout_marginLeft="70px" android:layout_width="45px" android:layout_height="45px" />
Welcome back