Why the following listing shows only the second TextView
(red)?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="11111"
android:background="#00FF00" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0"
android:background="#FF0000"
android:text="00000"/>
</LinearLayout>
I know that if I set android:layout_height="0px"
it will only show the first TextView
(green), and I understand this behavior.
But why when I set android:layout_height="match_parent"
, the first TextView
disappear completely from the screen.