October 24, 2024
Chicago 12, Melborne City, USA
Android

Simple Analog Watch Face with WatchFaceFormat (WFF)


Question:

I’m trying to create a simple analog watch face, however there is lack of sufficient code samples, and documentation. How can I create a simple analog watch face without using any resource files like png/svg.

Tried/Code:

I’ve tried so many different iterations of the code below, with hopes I can create a simple watch face to no avail, so what I in the /raw/watchface.xml is as follows:

<?xml version="1.0"?>
<WatchFace width="450" height="450">
    <Metadata key="CLOCK_TYPE" value="ANALOG" />
    <Metadata key="PREVIEW_TIME" value="10:08:32" />

    <Scene backgroundColor="#000000">
        <!-- Analog Clock with Hour, Minute, and Second hands as Rectangles -->
        <AnalogClock x="0" y="0" width="450" height="450">
            <!-- Hour Hand (Rectangle) -->
            <HourHand x="225" y="225" width="8" height="100" pivotX="4" pivotY="80" alpha="255">
                <Rectangle x="0" y="0" width="8" height="100" color="#ffffff" />
            </HourHand>

            <!-- Minute Hand (Rectangle) -->
            <MinuteHand x="225" y="225" width="6" height="130" pivotX="3" pivotY="110" alpha="255">
                <Rectangle x="0" y="0" width="6" height="130" color="#00ff00" />
            </MinuteHand>

            <!-- Second Hand (Rectangle) -->
            <SecondHand x="225" y="225" width="2" height="150" pivotX="1" pivotY="130" alpha="255">
                <Rectangle x="0" y="0" width="2" height="150" color="#ff0000" />
            </SecondHand>
        </AnalogClock>
    </Scene>
</WatchFace>

Research:



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video