如何使用Compose呈现普通的android ProgressBar? [英] How can I render plain android ProgressBar with Compose?
问题描述
我的应用程序需要一个ProgressBar,并且我试图用Jetpack Compose来实现它,所以我需要内置的ProgressBar支持(我没有找到它),或者应该有一种机制可以显示带有Compose的普通Android Widget.这有可能吗?
My application needs a ProgressBar, and I am trying to implement it with Jetpack Compose, so either I need a builtin ProgressBar support (I didn't find it) or there should be a mechanism to display plain Android Widgets with Compose. Is anything of this possible?
推荐答案
当然,Jetpack Compose中有进度条:
Ofcourse, we have Progress Bars in Jetpack Compose:
CircularProgressIndicator :将进度条显示为Circle.这是不确定的.主题设置为样式中的原色.确定的另一种变体是将论点进展为Float(0.0f-1.0f)
CircularProgressIndicator: Displays progress bar as Circle. It is indeterminate. Themed to Primary color set in styles. Another variant is determinate that takes progress in argument as Float (0.0f - 1.0f)
示例:
// Indeterminate
CircularProgresIndicator()
// Determinate
CircularProgressIndicator(progress = 0.5f)
LinearProgressIndicator:将进度条显示为一行.这是不确定的.主题设置为样式中的原色.确定的另一种变体是将论点进展为Float(0.0f-1.0f)
LinearProgressIndicator: Displays progress bar as line. It is indeterminate. Themed to Primary color set in styles. Another variant is determinate that takes progress in argument as Float (0.0f - 1.0f)
示例:
// Indeterminate
LinearProgressIndicator()
// Determinate
LinearProgressIndicator(progress = 0.5f)
这篇关于如何使用Compose呈现普通的android ProgressBar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!