In my Kotlin Android App project I have Rows with Text and an Icon. The Icon right of Text shall be aligned to the end edge.
The Text has a Modifier with weight(200.0f), but I do not want to use weight(). When I remove the weight()
from text
as in the following the icon comes directly after Text. I tried to align it to CenterEnd - in vain.
Row(modifier = Modifier.fillMaxWidth()) {
Text(modifier = Modifier.weight(200.0f)){
//..
}
Icon() {
//
}
}
but I do not want to use weigth()
so I tried to remove it:
Row() {
Text(){
//..
}
Icon(modifier = Modifier.align(Alignment.CenterEnd)) {
//
}
}
CenterEnd reacts with an error:
Type mismatch. Required:Alignment.Vertical Found:Alignment
How can I align the icon to the end
side?
(Please, instead of discussing why to use weight() or not, I am just looking for alternatives)
EDIT:
Spacer(modifier = Modifier.SpaceBetween)
using horizontal arrangements = Space Between in Row https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/Arrangement