I'd like to have a `Row` with 2 `Texts` which both...
# compose
m
I'd like to have a
Row
with 2
Texts
which both take up 50% of the screen width. Here is an xml version of the thing I want to achieve:
Copy code
<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:
Copy code
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?
🧵 2
f
There is
weight
Modifier inside RowScope that works the same as the attribute in View system
m
Oh cool, thanks!
I tried playing with arrangements but none of them gave me the desired result.
weight
works like a charm 🙂