RelativeLayout is taking fullscreen for wrap_content

前端 未结 6 917
闹比i
闹比i 2020-11-27 14:58

Why does FOOBARZ get layed out all the way at the bottom when no elements are layout_height=\"fill_parent\" in other words, all elements are wrap_content for he

6条回答
  •  孤独总比滥情好
    2020-11-27 15:47

    From the RelativeLayout doc:

    Class Overview

    A Layout where the positions of the children can be described in relation to each other or to the parent.

    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 WRAP_CONTENT and a child set to ALIGN_PARENT_BOTTOM

    Class documentation

    Which is exactly your case. RelativeLayout can not do that.

提交回复
热议问题