Divider‘s height Parameter wurde umbenannt in thickness
– RickSanchez725
30. September 2020 um 11:55 Uhr
Was ist, wenn wir nicht möchten, dass es über die gesamte Breite passt? Ich möchte nur eine Linie mit fester Breite und fester Dicke, die durch Gesten interaktiv sein soll.
– Richard OnslowRoper
25. Oktober 2021 um 3:59 Uhr
@MARSK verwenden Sie dann einfach ein farbiges Kästchen, was ist was Divider tut intern – es ist ein super einfacher Wrapper, der zusammengesetzt werden kann: Box(modifier.then(indentMod).fillMaxWidth().height(thickness).background(color = color))
Column(
// forces the column to be as wide as the widest child,
// use .fillMaxWidth() to fill the parent instead
// https://developer.android.com/jetpack/compose/layout#intrinsic-measurements
modifier = Modifier.width(IntrinsicSize.Max)
) {
Text("one", Modifier.padding(4.dp))
// use the material divider
Divider(color = Color.Red, thickness = 1.dp)
Text("two", Modifier.padding(4.dp))
// or replace it with a custom one
Box(
modifier = Modifier
.fillMaxWidth()
.height(1.dp)
.background(color = Color.Red)
)
Text("three", Modifier.padding(4.dp))
}
Vertikale Linie
Row(
// forces the row to be as tall as the tallest child,
// use .fillMaxHeight() to fill the parent instead
// https://developer.android.com/jetpack/compose/layout#intrinsic-measurements
modifier = Modifier.height(IntrinsicSize.Min)
) {
Text("one", Modifier.padding(4.dp))
// use the material divider
Divider(
color = Color.Red,
modifier = Modifier
.fillMaxHeight()
.width(1.dp)
)
Text("two", Modifier.padding(4.dp))
// or replace it with a custom one
Box(
modifier = Modifier
.fillMaxHeight()
.width(1.dp)
.background(color = Color.Red)
)
Text("three", Modifier.padding(4.dp))
}
14319400cookie-checkZeichnen Sie eine Linie in Jetpack Composeyes