<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>
我知道如果我设置
android:layout_height="0px"
,它只会显示第一个TextView
(绿色),我理解这种行为。但是为什么当我设置android:layout_height="match_parent"
时,第一个TextView
完全从屏幕上消失了呢?
android:visibility="GONE"
隐藏一个视图。 - Phantômaxx