这仅适用于使用RelativeLayout时.
如果您将元素设置为一个其他元素,则表示该元素位于该元素的左侧.
但是如果这个元素会丢失,因为你删除它,例如它将与父对齐.
举个例子
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="102dp"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignWithParentIfMissing="true"
android:layout_alignBottom="@+id/textView1"
android:layout_toRightOf="@+id/textView1"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
看看会发生什么如果你删除textView1但不要触摸textView2.
它会到底部,左边(不正确,因为它在父母内部)
Android将相对于parent而不是元素定位元素,因为它是缺少的.
如果是与丢失元素相关的虚假参数将被忽略.