2

ウィジェットを関連付けようとしているので、次のようにコードを記述します。

<RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="90dp"
        android:background="@drawable/ad1"
        android:orientation="horizontal" >

        <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@drawable/ad1"
        android:orientation="horizontal"
        android:layout_toStartOf="@id/bt_menu" > // here there is error !!!!

        <EditText
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:hint="Menu "
        android:inputType="textVisiblePassword"/>
            </RelativeLayout>

        <ImageButton 
                 android:id="@+id/bt_menu" 
                 android:layout_width="50dp"
                 android:layout_height="50dp" 
                 android:layout_alignParentRight="true"
                 android:layout_alignParentTop="true"
                 android:background="@android:color/transparent"
                 android:scaleType="fitCenter" 
                 android:src="@drawable/menu5"
                 android:onClick="menu_onclick"/>
        </RelativeLayout>

この行にエラーがあります:

android:layout_toStartOf="@id/bt_menu"

エラー: 指定された名前に一致するリソースが見つかりません (「layout_toStartOf」で値「@id/bt_menu」)

誰か助けてください!!!!

よろしくお願いします..ファデル。

4

2 に答える 2

5

に変更します

 android:layout_toStartOf="@+id/bt_menu" >

「+」を追加します

参照している の前にあるlayout場合、Eclipse は保存されるまでそのことを認識していないようです。一度実行した後は、元の状態に戻すことができるはずです。でも、放っておいて損をするかはわかりません。のようなプロパティを使用する場合にこれを行いますlayout_belowが、Viewそれを相対的または同様のものにしたいが、そのままにしておきます。

Eclipse または使用しているエディタでこれを処理するより良い方法があるかもしれませんが、私の知る限り、これが最も簡単であり、それによる望ましくない影響については知りません。

于 2013-10-04T20:30:20.977 に答える