堆疊容器,子組件按照順序依次入棧,后一個(gè)子組件覆蓋前一個(gè)子組件。該組件從API Version 7開始支持??梢园咏M件。
一、接口
Stack(value?: { alignContent?: Alignment })
從API version 9開始,該接口支持在ArkTS卡片中使用。
二、屬性
除支持通用屬性外,還支持以下屬性:
三、示例
// xxx.ets
@Entry
@Component
struct StackExample {
build() {
Stack({ alignContent: Alignment.Bottom }) {
Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
}.width('100%').height(150).margin({ top: 5 })
}
}
四、效果展示
五、場(chǎng)景
卡片上實(shí)現(xiàn)堆疊的場(chǎng)景使用。文章來源:http://www.zghlxwxcb.cn/news/detail-726315.html
本文根據(jù)HarmonyOS官方文檔整理。
-----------------------------------
?著作權(quán)歸作者所有:來自51CTO博客作者鴻蒙時(shí)代的原創(chuàng)作品,請(qǐng)聯(lián)系作者獲取轉(zhuǎn)載授權(quán),否則將追究法律責(zé)任
HarmonyOS/OpenHarmony原生應(yīng)用-ArkTS萬能卡片組件Stack
https://blog.51cto.com/u_14946066/7773837文章來源地址http://www.zghlxwxcb.cn/news/detail-726315.html
到了這里,關(guān)于HarmonyOS/OpenHarmony原生應(yīng)用-ArkTS萬能卡片組件Stack的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!