如何在桌面中隐藏按钮
我正在使用
OutlinedButton(
onClick = {
// Perform an operation
// Hide the button
}) {
Text(text = "CLick Here")
}
与Android相比,桌面组合没有可见性修饰符。
对于Eg vienibility = view.gone
那么如何隐藏onclick
事件上的按钮?
I am developing an app with Desktop Compose Multi-Platform.
I need to hide the button when it has been clicked.
Please see below code:
OutlinedButton(
onClick = {
// Perform an operation
// Hide the button
}) {
Text(text = "CLick Here")
}
As compared to android, Desktop Compose does not have visibility modifiers.
for e.g. visibility = View.GONE
So how to hide the button on the onClick
event ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
组合中的任何视图修改都是使用状态变量进行的。
如果您需要完全删除视图,则可以这样做:
如果要在布局中保存空间,则只需使用
modifier.alpha
将其隐藏。例如,如果您有一个带有几个元素的行,并且您不希望它们在按钮消失后移动。我建议您在compose
Any view modifications in Compose are done using state variables.
If you need the view to be completely removed, you can do it like this:
If you want to save space in the layout, you can simply hide it with
Modifier.alpha
. For example, if you have a row with a couple of elements and you don't want them to move after the button disappears.I suggest you check out with state in Compose documentation, including this youtube video which explains the basic principles.