# 浮层

名称

参数类型

默认值

描述

overlay

title: string,

options: {

align?: Alignment,

offset?: {x: number, y: number}

}

{

align: Alignment.Center,

offset: {0, 0}

}

在当前组件上,增加遮罩文本,布局与当前组件相同。

## 示例 ``` @Entry @Component struct OverlayExample { build() { Column() { Column() { Text('floating layer') .fontSize(12).fontColor(0xCCCCCC).maxLines(1) Column() { Image($r('app.media.img')) .width(240).height(240) .overlay("Don't walk and play with your phone.", { align: Alignment.Bottom, offset: { x: 0, y: -15 } }) }.border({ color: Color.Black, width: 2 }) }.width('100%') }.padding({ top: 20 }) } } ``` ![](figures/overlay.gif)