I researched on another stackoverflow question//answer and found a working definition of layout_weight to be that "This attribute assigns an "importance" value to a view, and allows it to expand to fill any remaining space in the parent view" (source:What does android:layout_weight mean?)
I am trying to apply that concept to my code. Currently my code (without the layout weights) is
<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="match_parent"
android:layout_height="wrap_content"
android:text="Home"
android:gravity="center"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="About"
android:gravity="center"
/>
</LinearLayout>
And the current layout is https://i.stack.imgur.com/QTPGg.jpg (the home should take up all the space bc of match_parent)
However if i add android:layout_weight="1" to both text views, i get this layout https://i.stack.imgur.com/8y1Na.jpg
(Both are visible and share same amount of space)
My question is how is this happening from that working definition of layout_weight? layout_weight in this example will assign extra space equally to both the text views. But there is no extra space because the first one has width match_parent which will make it take the width of the entire parent(no extra space)