diff --git a/test_compose_ui_slider_100/app/src/main/java/com/example/jetpackcompose/MainActivity.kt b/test_compose_ui_slider_100/app/src/main/java/com/example/jetpackcompose/MainActivity.kt index 1f128866417bb5174519efefc5552e4a6de05e6f..25b5c087d10211eed3723390a2ab1bf7e7027e18 100644 --- a/test_compose_ui_slider_100/app/src/main/java/com/example/jetpackcompose/MainActivity.kt +++ b/test_compose_ui_slider_100/app/src/main/java/com/example/jetpackcompose/MainActivity.kt @@ -16,18 +16,25 @@ import com.example.jetpackcompose.ui.theme.JetpackComposeTheme class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + val min = 0f + val max = 1f + setContent { JetpackComposeTheme { // A surface container using the 'background' color from the theme Row { - var sliderPosition by remember { mutableStateOf(0f) } + var sliderPosition by remember { mutableStateOf(0.5f) } repeat(4) { Column( modifier = Modifier.weight(1f) ) { for (i in 1..25) { - Slider(value = sliderPosition, modifier = Modifier - .height(25.dp), onValueChange = { sliderPosition = it }) + Row(verticalAlignment = Alignment.CenterVertically) { + Text(text = (sliderPosition * 100).toInt().toString(), Modifier.width(30.dp)) + Slider( + valueRange = (min..max), value = sliderPosition, modifier = Modifier + .height(25.dp), onValueChange = { sliderPosition = it }) + } } } } diff --git a/test_compose_ui_slider_100/test_compose_ui_slider_100.apk b/test_compose_ui_slider_100/test_compose_ui_slider_100.apk index ed5a20b8b2f3ab9301083ea6fd82aa3fb5a71799..5d7898eb0c58bfb3b35f95996e11227b88e7a38c 100644 Binary files a/test_compose_ui_slider_100/test_compose_ui_slider_100.apk and b/test_compose_ui_slider_100/test_compose_ui_slider_100.apk differ