WeightSum alternative in RelativeLayout?

I have four TextView elements that I want to evenly distribute along a horizontal line. This means that all space in the line should be evenly occupied by TextView elements. Like this:

Evenly spaced TextViews

I used to use LinearLayout for this. I had weightSum as 4 and assigned layout_weight of 1 for each TextView element. However, this compromise regarding some functions that I want to implement in my application:

I want to put an EditText element under each of the four TextView elements. When the EditText elements are visible, INVIVIBLE will be set first, and then with one click of the EditTexts button it will become visible, and Textviews visibility will be set to INVISIBLE. This is only possible if I use RelativeLayout

So, how can I use RelativeLayout for four TextView elements, uniformly consuming all the space?

+6
source share
1 answer

Simply put, you cannot. This is why you used LinearLayout as a container of 4 TextViews.

+2
source

All Articles