跳转至

ProgressIndicator

CircularProgressIndicator

属性

@Composable
fun CircularProgressIndicator(
    progress: Float?,
    modifier: Modifier? = Modifier,
    color: Color? = MaterialTheme.colors.primary,
    strokeWidth: Dp? = ProgressIndicatorDefaults.StrokeWidth
): Unit

参数

  • progress 当前进度0.0~1.0之间,不传递为滚动进度
  • color 进度条颜色
  • strokeWidth 进度条大小
@Composable
fun CircularProgressIndicatorSample() {
    CircularProgressIndicator(
        color = Color.Red, strokeWidth = 10.dp
    )
}

progress1

不传 porgress参数情况

@Composable
fun CircularProgressIndicatorSample1() {
    CircularProgressIndicator(progress = 0.5f)
}

progress2

LinearProgressIndicator

@Composable
fun LinearProgressIndicatorSample() {
    LinearProgressIndicator(color = Color.Red, backgroundColor = Color.Green)
}

progress3

@Composable
fun LinearProgressIndicatorSample1() {
    LinearProgressIndicator(progress = 0.3f, color = Color.Red, backgroundColor = Color.Green)
}

progress4

视频教程

https://www.bilibili.com/video/BV1fT4y1D7yZ

实战视频