alignwithparentifmissing专题

解决RelativeLayout中 gone之后的布局错位问题。RelativeLayout的layout_alignWithParentIfMissing

如上图。  相对布局,假如最右边的设置gone后, 左边两个就会跑到最左边去。  在这两个里面加上 android:layout_alignWithParentIfMissing="true"  就好了~ If set to true, the parent will be used as the anchor when the anchor cannot be be foun

RelativeLayout的alignWithParentIfMissing

针对RelativeLayout有一点需要注意,因为它内部是通过多个View之间的关系而确定的框架,那么当其中某一个View因为某些需要调用GONE 来完全隐藏掉后,会影响与其相关联的Views。Android为我们提供了一个属性 alignWithParentIfMissing  用于解决类似问题,当某一个View无法找到与其相关联 的Views后将依据alignWithParentIfMiss