Alternative to weightSum in RelativeLayout?

android, android-layout, android-relativelayout

Solution

Simply put, you can't. That's why you were using a LinearLayout as the 4 TextViews container.

Problem

I have four `TextView` items that I want to evenly spread in a horizontal line. This means that all the space in a line must be evenly occupied by the `TextView` items. Like this: Previously, I used LinearLayout for this. I had the weightSum as 4 and assigned a layout_weight of 1 to each `TextView` item. However, this compromises on some functionality I want to implement in my app: I want to put an `EditText` item under each of the four `TextView` items. The `EditText` items visibility will be set to INVISIBLE first, and then at the touch of a button, the EditTexts will become visible and the visibility of the Textviews will be set to INVISIBLE. This is only possible if I use RelativeLayout So how do I use RelativeLayout for the four `TextView` items while evenly occupying all the space?

Original source