[英]Custom TabRow in Jetpack Compose
To remove the line under the tabs just set an empty divider by passing divider = {}
.要删除选项卡下的行,只需通过传递
divider = {}
设置一个空分隔divider = {}
。
To make the tabs fill the space available in the TabRow
(therefore without empty spaces), just do not set a specific size to the Tabs, the following example works as you ask.要使选项卡填充
TabRow
可用空间(因此没有空格),只需不要为选项卡设置特定大小,以下示例按您的要求工作。
var state by remember { mutableStateOf(0) }
val titles = listOf("TAB 1", "TAB 2")
Column {
TabRow(selectedTabIndex = state, divider = {}) {
titles.forEachIndexed { index, title ->
Tab(
text = { Text(title) },
selected = state == index,
onClick = { state = index }
)
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.