mzgreen
04/22/2021, 9:02 AMRow
with 2 Texts
which both take up 50% of the screen width. Here is an xml version of the thing I want to achieve:
<LinearLayout xmlns:android="<http://schemas.android.com/apk/res/android>"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Foo"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Bar"
/>
</LinearLayout>
I came up with this:
Row(Modifier.fillMaxWidth()) {
Text(text = "Foo", Modifier.fillMaxWidth(0.5f))
Text(text = "Bar", Modifier.fillMaxWidth())
}
Is there some other, maybe better way to do it?Filip Wiesner
04/22/2021, 9:04 AMweight
Modifier inside RowScope that works the same as the attribute in View systemmzgreen
04/22/2021, 9:06 AMmzgreen
04/22/2021, 9:07 AMweight
works like a charm 🙂