03-30 14:19:26.690: E/AndroidRuntime(8437): java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout

在相对布局中不能存在循环依赖! 比如先A在B的下边,就不能定义B在A上下左右。。。

而源码中也提到了另外一种循环依赖: RelativeLayout layout_height设置为wrap_content,然后设置子viewlayout_alignParentBottom=“true”。 RelativeLayout高依赖于子View,而子View又声称在RelativeLayout的底部。


/**
* 
* Note that you cannot have a circular dependency between the size of the RelativeLayout and the
* position of its children. For example, you cannot have a RelativeLayout whose height is set to
* {@link android.view.ViewGroup.LayoutParams# WRAP_CONTENT WRAP_CONTENT} and a child set to
* {@link# ALIGN_PARENT_BOTTOM}.
* 
*/

但是这种情况不会出现异常,实际上相当于设置fill_parent的效果。