Beginner Q&A - Watch App Views

Former Member
Former Member
I have a few beginning watch app developer questions about how to lay out my views.

1. Is there any kind of layout manager to assist with building views, or is everything absolutely positioned? For example, if all I'm adding is a few text inputs, do I have to figure out the correct y-offset for each of them?

2. Do screens automatically scroll or do I have to implement that myself via trigger points? Do I have to know the height of the screen I'm programming to?

3. The Monkey C Programming Guide talks about using XML to define a view as a list of drawables but the example just shows how to reference the top-level. Can I reference the individual drawables within that view? For example, say I lay out my entire screen in XML, but I need to change the text on the labels, can I do that or can I only reference the top-level drawable?
  • Look around at the samples in the SDK. Most of your questions will be answered, and you'll learn about the environment.
  • Former Member
    Former Member over 10 years ago
    As somebody who has developed software in Java for 20 years, I was hoping for more from MonkeyC. Even the first version of Java that used AWT had a few basic layout managers so you didn't have to absolutely position your fields on the screen. On the one hand Garmin talks about an SDK that makes it simple to write an app that operates on multiple devices, then they turn around and make you lay out your screen by hand. I realize a watch app is very simple but one could hope for more help from the SDK.

    Unless I missed something in the examples that all absolutely position fields on the screen. I still haven't figured out if any of the examples have any form of scrolling.

    I was hoping for a couple of simple layout managers like maybe a vertical, table or grid. They could also go the way of Apple and add constraints so your field is laid out in relation to another field. It seems like this would be easy to write and would greatly simplify writing a UI for a watch app.
  • So, you haven't looked at the samples. Create a new watchface project, as it uses layouts. Or read the Monkey C programmers guide included with the SDK! (You can have a different layout per device type!)

    As far as scrolling, you need to look for events and manage the views.
  • Former Member
    Former Member over 10 years ago
    If by samples you mean watch faces, then no I haven't looked at them. I'm not trying to create a watch face, I'm trying to create a watch app, and all of those that I could find are using absolute positioning.
  • Search for an example that has a call to setLayout. You still have to absolutely position each element, but each device can have a unique layout described in an external xml file.

    Having a complex layout system for positioning elements at runtime is _likely_ not feasible on a ConnectIQ device. It would use precious resources (memory) and not be very useful since the application window size doesn't change at runtime. I do agree it would be nice to have a program that would allow users to drag/drop UI elements into positions and generate the xml layout file. I don't think it would be incredibly difficult to get something like this working, but I think it might be difficult to get perfect. This is definitely something that any of us could implement; it doesn't have to come from Garmin.

    Travis