# Stack 堆叠容器,子组件按照顺序依次入栈,后一个子组件覆盖前一个子组件。 ## 权限列表 无 ## 子组件 可以包含子组件。 ## 接口 Stack\(options?: \{ alignContent?: Alignment \}\) - 参数

参数名

参数类型

必填

默认值

参数描述

alignContent

Alignment

Center

设置子组件在容器内的对齐方式。

## 示例 ``` @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 }) } } ``` ![](figures/stack.jpg)