BoxAlignments

interface BoxAlignments

为 androidx.compose.foundation.layout.Box 提供常用的 Alignment 创建工厂接口。

androidx.compose.foundation.layout.Box 是最常用的容器布局之一,可通过对齐参数控制单个子项在父容器中的摆放位置。 本接口定义了 9 种常用位置组合:

  • 顶部:TopStartTopCenterTopEnd

  • 中部:CenterStartCenterCenterEnd

  • 底部:BottomStartBottomCenterBottomEnd

对齐行为会根据 androidx.compose.ui.unit.LayoutDirection 自动处理左右反转。

See also

androidx.compose.foundation.layout.Box
androidx.compose.ui.Alignment

Functions

Link copied to clipboard
abstract fun getBottomCenter(): Alignment

组件位于容器底部居中位置。

Link copied to clipboard
abstract fun getBottomEnd(): Alignment

组件位于容器右下角(受布局方向影响)。

Link copied to clipboard
abstract fun getBottomStart(): Alignment

组件位于容器左下角(受布局方向影响)。

Link copied to clipboard
abstract fun getCenter(): Alignment

组件位于容器中心位置。

Link copied to clipboard
abstract fun getCenterEnd(): Alignment

组件位于容器右侧中间(受布局方向影响)。

Link copied to clipboard
abstract fun getCenterStart(): Alignment

组件位于容器左侧中间(受布局方向影响)。

Link copied to clipboard
abstract fun getTopCenter(): Alignment

组件位于容器上方居中位置。

Link copied to clipboard
abstract fun getTopEnd(): Alignment

组件位于容器右上角(受布局方向影响)。

Link copied to clipboard
abstract fun getTopStart(): Alignment

组件位于容器左上角(受布局方向影响)。