使用传统的 XML,您可以使用它的 id 或标签获取 View 的实例。
这在jetpack compose中怎么可能?
Card(elevation = 1.dp, shape = RoundedCornerShape(8.dp), color = Color.Transparent) {
// TARGET is here
Padding(padding = 8.dp) {
Text(text = "Net stat", style = +themeTextStyle { h6 })
}
}
Text(text = netStatusState.value)
HeightSpacer(height = 10.dp)
Divider()
HeightSpacer(height = 10.dp)
Card(elevation = 1.dp, shape = RoundedCornerShape(8.dp), color = Color.Transparent) {
Padding(padding = 8.dp) {
Clickable(onClick = {
// MODIFY (Remove, change element, update attr) the target
}) {
Button(text = "Click me if you can")
}
}
}
它甚至需要这样的功能,还是全部使用 state 完成?