Harmony OS 2

Huawei HarmonyOS 2 adds 5 practical examples of Sample: Grid layout, adaptive card and more

Huawei HarmonyOS has released the new Sample this week, and five super practical examples have been added. Click the download link below to download and learn!

Sample 1: Add NativeLayer sample

Scenario: Native_layer declares the JNI related to the native layer. This example shows the use of the JNI interface on Native_layer, so that the application can obtain the native layer that matches the Java surface object, obtain the native layer information, and also set the native layer size and layer grid.

Advertisement

● Download link:

https://gitee.com/openharmony/app_samples/tree/master/native/NativeLayer

Sample 2: New grid layout

Advertisement

Scenario: This example uses a grid system for element layout, which is mainly implemented by the <grid-container\>, <grid-row\>, and <grid-col\> tags.

● Download link:

https://gitee.com/openharmony/app_samples/tree/master/UI/JsGrid

Advertisement

Sample 3: New JS canvas example

Scenario: The <canvas\> component can be customized to draw graphics. This example shows how to use the <canvas\> component.

●Download link:

Advertisement

https://gitee.com/openharmony/app_samples/tree/master/UI/JsCanvas

Sample 4: New adaptive page and adaptive efficiency homepage example

Scenario: This example uses five types of immersive cards, graphic cards, grid cards, plain text cards, and multi-dimensional information cards to demonstrate the adaptive capabilities of cards on devices of different sizes. When the card is extremely wide and extremely high, the card will be displayed through adaptive capabilities such as stretching, zooming, hiding, folding, and evenly dividing.

Advertisement

● Download link:

https://gitee.com/openharmony/app_samples/tree/master/UI/JsAdaptivePortalPage

Sample 5: New adaptive card example

Advertisement

Scenario: This example shows a list page. On devices of different sizes, through adaptive capabilities such as stretching, zooming, sharing, and proportioning, it uses polymorphic controls, the extensibility of layouts and components, and the use of responsive layouts. , Adaptive display is a reasonable layout effect.

● Download link:

https://gitee.com/openharmony/app_samples/tree/master/UI/JsAdaptiveServiceWidget

Advertisement

If you have any questions or needs during use, please submit an issue on Gitee.

(Via)

Advertisement
Min

Min En specializes in smartphone reviews, EMUI/HarmonyOS coverage, and mobile industry analysis. His in-depth knowledge of Huawei's ecosystem, from flagship devices to emerging technologies, makes him a trusted voice in the tech community.

Recent Posts

Why Your Huawei Phone WiFi Keeps Disconnecting (And How I Fixed It)

Okay, so you're sitting in your favorite café, scrolling through Instagram, and suddenly your WiFi…

1 month ago

Huawei Phone Not Charging? 9 Complete Fixes

Your Huawei phone won't charge. You plug it in, nothing happens. Before you panic or…

1 month ago

How to Unlock Huawei Phone: Key Methods Without Data Loss

Locked out of your Huawei phone? Don't panic. Whether you've forgotten your password, PIN, pattern,…

1 month ago

Huawei Phone Battery Drain Fix: Complete Troubleshooting Guide (2026)

Is your Huawei phone dying in just a few hours? You're not alone. Battery drain…

1 month ago

Huawei Mate 70 Air shows up in a promotional photo

Huawei is getting ready to release a new super-thin phone called the Mate 70 Air.…

6 months ago

Huawei Mate 80 series latest Information

Tipster Digital Chat Station has confirmed that the Chinese tech giant Huawei will release new…

8 months ago