Responsive Design with HarmonyOS ArkUI Media Queries
Media queries enable dynamic UI adjustments based on device attributes like screen dimensions, resolution, orientation, and color depth. They form the foundation of responsive application design, ensuring consistent and optimal user experiences across diverse hardware. Typical use cases include adaptive layouts, typography scaling, conditional ...
Posted on Tue, 04 Aug 2026 16:41:01 +0000 by unbreakable9
HarmonyOS N-API Module Loading in Main Thread
Module Loading Overview
The Node-API napi_load_module intreface enables module loading in the main thread. After loading, developers can retrieve exported properties using napi_get_property or access functions via napi_get_named_property. Supported scenarios include:
Loading system modules (e.g., @ohos.hilog)
Loading modules from ArkTS files
...
Posted on Fri, 31 Jul 2026 16:08:29 +0000 by himnbandit
Working with XML in HarmonyOS ArkTS: Structure Definition and Processing
An XML element consists of three main parts:
Tag: Marks the begining and end of an element
Attributes: Provide additional information about the element
Content: The data contained within the element
Element Structure Example
<book category="fiction">
<title>XML Fundamentals</title>
<author>Jane Smith</ ...
Posted on Fri, 24 Jul 2026 16:39:15 +0000 by bagsobrands
AOP in the HarmonyOS Architecture
Introduction to AOP
For developers familiar with Android or Java Web development, the concept of Aspect-Oriented Programming (AOP) is well-established. The core of AOP lies in identifying an aspect and then performing pre-processing or post-processing on a specific business operation, or even replacing the operation entirely. The granularity of ...
Posted on Thu, 16 Jul 2026 16:26:55 +0000 by gtibok
HarmonyOS ArkUI Combined Gesture Events
Gesture Type
Functionality
Swipe
Fast screen swiping for page navigation and content scrolling
Tap
Single touch for button activation and app launching
Double Tap
Two quick touches for zooming images or opening apps
Long Press
Sustained touch for context menus and drag operations
Pinch
Two-finger movement for zooming and scaling
...
Posted on Tue, 14 Jul 2026 17:03:54 +0000 by ShadowMetis
Implementing Persistent Worker Threads in HarmonyOS
In HarmonyOS, while TaskPool is ideal for short-lived, independent tasks, scenarios requiring long-lived state or persistent object handles often necessitate the use of Worker threads. Unlike TaskPool, which manages task lifecycles automatically, Worker allows for maintaining a single, consistent execution context.
Creating and Managing a Worke ...
Posted on Mon, 13 Jul 2026 16:51:23 +0000 by Merdok
HarmonyOS Node-API Lifecycle and Error Diagnosis Patterns
Distinguishing Lifetimes of napi_value and napi_ref
napi_value instances are automatically tracked and retained within the current HandleScope. Explicit scope management is typically unnecessary—except in asynchronous completion callbacks (e.g., those invoked after uv_queue_work). In such contexts, a dedicated HandleScope must be establisehd b ...
Posted on Mon, 06 Jul 2026 17:48:21 +0000 by indian98476
Building Grid Layouts in HarmonyOS with Grid and GridItem
To create responsive grid layouts in HarmonyOS, developers use the Grid container along with GridItem children. This approach supports flexible sizing, spacing, direction control, and even pagination.
Defining Rows and Columns with Templates
The structure of a grid is defined using rowsTemplate and columnsTemplate, which accept CSS-like fractio ...
Posted on Wed, 01 Jul 2026 17:59:05 +0000 by aka_bigred
Managing Application Context in HarmonyOS Stage Model
Overview of Context TypesIn the HarmonyOS Stage model, Context provides access to application resources, paths, and configurations. Several specialized context classes inherit from the base Context class, including ApplicationContext, AbilityStageContext, UIAbilityContext, and ExtensionContext. These subclasses provide specific capabilities whi ...
Posted on Thu, 25 Jun 2026 17:40:44 +0000 by thewomb
Implementing Tab Navigation in HarmonyOS Applications
Bottom Navigation Bar
@Entry
@Component
struct MainScreen {
build() {
Column() {
Tabs({ barPosition: BarPosition.End }) {
TabContent() {
Text('Home Screen').fontSize(30)
}.tabBar('Home')
TabContent() {
Text('Discovery Screen').fontSize(30)
}.tabBar('Discovery')
TabContent ...
Posted on Tue, 23 Jun 2026 17:09:58 +0000 by rich1983