Zepp OS 4.0 New Features
Zepp OS API_LEVEL 4.0 brings several important updates and new features, providing developers with more powerful tools and a more flexible development experience. This article will introduce the main new features and improvements.
Widget Layout Properties for Flex Layout
For more details, refer to Widget Layout Properties for Flex Layout.
In Zepp OS, API_LEVEL 4.0 introduces support for Flex layout, allowing developers to build smartwatch application interfaces in a way similar to Web development, greatly improving layout flexibility and development efficiency.
Widget Property Read/Write
For more details, refer to Widget Getter/Setter Feature.
Starting from API_LEVEL 4.0, Zepp OS supports direct access and modification of widget properties through getter/setter features, making property read/write operations more concise and intuitive.
The widget documentation will indicate property access support status.
import { createWidget, widget, prop } from '@zos/ui'
Page({
build() {
// Create TEXT widget
const textWidget = createWidget(widget.TEXT, {
// ...
})
// Using getter to read properties
console.log('Text content:', textWidget.text)
console.log('Text color:', textWidget.color)
console.log('Text position:', textWidget.x, textWidget.y)
// Using setter to set properties
textWidget.text = 'Updated Text'
textWidget.color = 0xff0000
textWidget.x = 120
// Comparison with old method
// Reading properties
const oldText = textWidget.getProperty(prop.TEXT)
console.log('Old way - Text content:', oldText)
// Setting properties
textWidget.setProperty(prop.TEXT, 'Set by old method')
textWidget.setProperty(prop.MORE, {
color: 0x00ff00,
x: 150
})
}
})
New UI Widgets/Methods
- Smart Keyboard SMART_KEYBOARD
Sensor Module
Compasssupports setting sensor reporting frequencyGeolocationcan retrieve the user's privacy location permission protection status
@zos/app Module
Get mini app performance statistics, including memory usage and loading performance metrics.
@zos/util Module
Added new utility methods that support conversion between ArrayBuffer and String types, making data processing easier