这里是我的(相关)XML代码:没有资源发现匹配给定名称
<RelativeLayout
<Button
android:id="@+id/menu_button"
android:layout_width="50dp"
android:layout_height="0dp"
android:layout_marginBottom="60dp"
android:layout_marginTop="8dp"
android:background="@mipmap/ic_launcher"
android:onClick="myOnClickMethod"
android:layout_below="@id/whiteBackground" <---- ERROR HERE
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"/>
<ImageView
android:id="@+id/whiteBackground" <---- HERE IS THE ID
android:layout_width="350dp"
android:layout_height="350dp"
android:contentDescription="@string/white_background"
android:tag="white"
android:visibility="visible"
android:background="@drawable/myrect"
android:elevation="15dp"
android:layout_below="@id/image_text_editor"
android:layout_centerInParent="true"/>
<Button
android:id="@+id/text_size_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/size"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_marginRight="8dp"
android:layout_marginLeft="8dp"
android:visibility="visible"
android:onClick="SizeChange"
android:layout_below="@id/whiteBackground" <---- ALSO BEING USED HERE (NO ERROR)
android:layout_toLeftOf="@id/menu_button"/>
<Button
android:id="@+id/move_Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/menu_button"
android:layout_below="@id/whiteBackground" <----ALSO BEING USED HERE (NO ERROR)
android:layout_margin="8dp"
android:onClick="MoveChange"
android:text="MOVE"/>
</RelativeLayout>
我的注意的行收到一个错误之上。它告诉我
No resource found that matches the given name (at 'layout_below' with value '@id/whiteBackground').
我不知道为什么会这样,因为你可以看到ID /元素坐在下方注意的地方。正如你可以看到下面的其他2个按钮也使用相同的layout_below="@id/whiteBackground"
,并且没有错误。这只是一条线。
如果有人能告诉我发生了什么事情,那将不胜感激。
感谢
尝试'@ + id'你第一次引用它(读从上到下)和'@ id'之后每次。 – stkent
非常感谢你@stkent我猜这只是发生在相关布局中的东西 –
它发生在RelativeLayout的更常见的情况是,但它不是唯一的! – stkent