Personal experience - layout_height property is set RelativeLayout Android layout of the pit when wrap_content

layout_height property is set RelativeLayout layout of Android is wrap_content pit:

This condition occurs in the pit:

layout_height property is set 1.RelativeLayout layout is wrap_content

2. a "Center View" is set to layout_centerX (layout_centerVertical, layout_centerHorizontal, layout_centerInParent)

3. Other View with respect to the "Center View" to do the layout

At this pit appeared:

View other matter provided below (layout_below, layout_below) "centered View", above (layout_above), align the bottom (layout_alignBottom) and so on, all invalid!

 

Filled pit program:

layout_height property RelativeLayout layout can be set to match_parent!

Even if the outer space has equally LinearLayout layout_weight use, it match_parent not stretch outer LinearLayout space.

Originally want to set wrap_content, in fact, is the fear of internal RelativeLayout set after match_parent is stretch it, proved too much concern!

Reproduced in: https: //www.cnblogs.com/AsionTang/p/4029446.html

Guess you like

Origin blog.csdn.net/weixin_34240520/article/details/93270811