これは、RelativeLayoutを使用する場合にのみ適用されます。
要素をtoLeftOfに設定すると、この要素の左側にあることを意味します。
ただし、この要素が削除されると、この要素が欠落しているなど、削除される可能性があります。たとえば、削除すると親に揃えられます。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
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" />
<TextView
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" />
</RelativeLayout>
この例を見てみましょうあなたはtextView1を削除すると何が起こるかを参照してくださいが、textView2に手を触れないでください。 (それは親の内側にあるので、右ではない)
それは
Androidのではなく、それが欠落しているので、それがあるべき要素の親要素を位置決めします左に、下に移動します。
falseの場合、欠落要素に関するパラメータは無視されます。
TextViewのレイアウトパラメータが無効です: layout_alignWithParentIfMissing - このエラーは発生しています – vhd
うん!出来た :) – vhd