Android布局 - 填充除了以外的其余空间

And*_*wJM 29 android android-layout

我有一个相对布局.为简单起见,有一个ImageView,EditTextButton:

  • ImageView是一个固定高度的横幅
  • 在那之下是和EditText哪里android:layout_width="fill_parent"
  • 下面是Button具有固定宽度和高度的

问题是我想要editText填充屏幕的剩余高度.将图像放在顶部,在底部放置一个按钮,在中间放置并编辑占据剩余空间的文本.

我必须使用什么属性来获得类似的东西?

pet*_*tos 68

为此,有LinearLayoutlayout_weight财产.使用LinearLayout了持有这些3个元素.对于ButtonImageView,设置layout_heightwrap_content.对于EditText集合layout_height="0dp"layout_weight="1".