这是我的代码:
Text(
text = "Resend OTP",
fontSize = 20.sp,
color = Textfieldcolor,
style = TextStyle(textDecoration = TextDecoration.Underline)
)
Run Code Online (Sandbox Code Playgroud)
我希望文本可以点击一次然后禁用。
我该怎么做呢?
text kotlin android-studio android-jetpack android-jetpack-compose
这就是我想要实现的目标:

因此,我连续创建了 2 个圆形按钮,并根据是否选择它们提供了不同的背景颜色。目标是创建一种选项卡/切换的错觉。
未选中的按钮将具有与该行的背景颜色相同的颜色。不幸的是,由于行是矩形形状,因此在拐角处有残留空间,但仍然显示背景颜色。


这是我的按钮代码
val cornerRadius = 20.dp
var selectedIndex by remember { mutableStateOf(0)}
val configuration = LocalConfiguration.current
val screenWidth = configuration.screenWidthDp.dp
val items = listOf(
OutlinedButton(onClick = { /*TODO*/ }) {
},
OutlinedButton(onClick = { /*TODO*/ }) {
})
Row(
modifier = Modifier
.padding(top = 8.dp)
.wrapContentHeight()
.width(screenWidth).background(color = Color.Gray).clip(shape = RoundedCornerShape(20.dp))
) {
// Spacer(modifier = Modifier.weight(1f))
items.forEachIndexed { index, item ->
OutlinedButton(modifier = Modifier
.wrapContentHeight()
.width(screenWidth/2),
shape = when (index) {
// left outer button …Run Code Online (Sandbox Code Playgroud) 我已经用 jetpack compose 完成了整个项目(包含 3 个活动)。我需要使用 xml 和 kotlin 完成一项活动,因为我不知道如何在 jetpack 中完成它(我对两者都是新手)。是否可以将新活动与其余代码集成?