How do I enforce a circular reference in a RelativeLayout?

我们两清 提交于 2019-12-05 01:17:32

The first time you reference an ID, use the @+ prefix, which tells the resource builder to add the ID, rather than trying to find it. So try:

android:layout_toLeftOf="@+id/imgArrow"

A circular reference is the thing you want to avoid. But to solve your problem just switch the definition of your Button and ImageView so that the ImageView you're refering in the Button is defined first. For some reasons it is not possible to do it the other way round.

Additionally I would always use the same refernence type. So in your case: "@+id/imgArrow"

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!