【鸿蒙 HarmonyOS】UI 布局 ( 帧布局 StackLayout )
生活随笔
收集整理的這篇文章主要介紹了
【鸿蒙 HarmonyOS】UI 布局 ( 帧布局 StackLayout )
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
文章目錄
- 一、幀布局 StackLayout
一、幀布局 StackLayout
幀布局 StackLayout 可以只設置一個寬度高度屬性 , 不設置其它屬性 ;
幀布局的特性是可以多層疊加 , 后面的組件會疊加在前面的組件上面 ;
幀布局 StackLayout 示例 :
下面的幀布局 , 寫在后面的組件在上層 , 寫在前面的組件在最底層 ;
text1 組件在最底層 , text2 組件在中間層 , text3 組件在最上層 ;
text1 組件被上面兩層覆蓋 , text2 組件被 text3 組件覆蓋 ;
<?xml version="1.0" encoding="utf-8"?> <StackLayoutxmlns:ohos="http://schemas.huawei.com/res/ohos"ohos:height="match_parent"ohos:width="match_parent"><!-- 最底層 --><Textohos:id="$+id:text1"ohos:height="800"ohos:width="800"ohos:background_element="#FF0000"ohos:text_size="50"/><!-- 中間層 --><Textohos:id="$+id:text2"ohos:height="600"ohos:width="600"ohos:background_element="#00FF00"ohos:text_size="50"/><!-- 最上層 --><Textohos:id="$+id:text3"ohos:height="400"ohos:width="400"ohos:background_element="#0000FF"ohos:text_size="50"/></StackLayout>效果展示 :
總結
以上是生活随笔為你收集整理的【鸿蒙 HarmonyOS】UI 布局 ( 帧布局 StackLayout )的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【错误记录】Android NDK 错误
- 下一篇: 【鸿蒙 HarmonyOS】Abilit