W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
堆疊容器,子組件按照順序依次入棧,后一個子組件覆蓋前一個子組件。
該組件從API Version 7開始支持。后續(xù)版本如有新增內(nèi)容,則采用上角標單獨標記該內(nèi)容的起始版本。
Stack(value?: { alignContent?: Alignment })
從API version 9開始,該接口支持在ArkTS卡片中使用。
參數(shù):
參數(shù)名 | 參數(shù)類型 | 必填 | 參數(shù)描述 |
---|---|---|---|
alignContent | 否 | 設置子組件在容器內(nèi)的對齊方式。 默認值:Alignment.Center |
- // 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 })
- }
- }
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: