06-04-2018 05:13 - edited 06-05-2018 23:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-04-2018 05:13 - edited 06-05-2018 23:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Fitbit OS 2.0 seems to have internal 9-patch PNG support when compiling to TXI format, but it is not opened to the Studio yet. This feature is particularly useful when customised creating frames or rectangles with customised styles like round corner.
See the 2nd reply for more details.
---------------------
Original post...
Title: Round corner rectangle: How did square-button achieve it?
In the square-button docs under User Interface/Components/Buttons, the button have seems achieved a round-corner rectangle with 8-bit PNG images that is resizable, as it accepts fill and opacity for its colouring, but I didn't find any related resources on the documentation that does this trick.
Did it use some undocumented tricks? Is it possible for us to do the same thing?
06-05-2018 16:53 - edited 06-05-2018 17:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-05-2018 16:53 - edited 06-05-2018 17:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
If you want to see how it's achieved, you can look into the code behind it as it's part of the simulator.
The files square_button_widget.css and square_button_widget.gui contains all the code used to draw them.
They can be found in you user directory where the simulator is installed.
for Windows users it's in: \AppData\Local\Programs\@fitbitsimulator\resources\static\devicesim\win\meson\Resources\widgets\
06-05-2018 23:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-05-2018 23:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks for the hint.
It seems that they used an Android-format 9-patch PNG for the button image.
I've tried both to create my own 9-patch PNG and to throw in the PNG i found in that folder, they all stretch like normal image without taking consideration of the actual 9-patch configuration. However, direct reference to the .txi file like what the square-button-widget did do work.
So I guess that the 9-patch PNG feature wasn't considered when compiling .txi files with FitBit Studio.

