Android Layout - fill the rest of the space except
I have a relative layout. For simplicity, there is an ImageView, EditText, and Button:
- The
ImageViewis a banner with a fixed height - Below that is and the
EditTextwhereandroid:layout_width="fill_parent" - Below that is a
Buttonwith a fixed width an开发者_StackOverflow中文版d height
The problem is I want the editText to fill the leftover height of the screen. put and image on the top, a button on the bottom, and in the middle and edit text that takes up the rest of the space.
What property would i have to work with to get something similar to this?
For this purpose, there is LinearLayout with layout_weight property. Use LinearLayout for holding these 3 elements. For Button and ImageView, set layout_height as wrap_content. For EditText set layout_height="0dp" and layout_weight="1".
Have you considered using Relative Layout?
You could use
android:layout_below
android:layout_alignParentTop
android:layout_alignParentBottom
android:layout_marginTop
android:layout_marginBottom
Try that and post some sample code if you get stuck.
加载中,请稍侯......
精彩评论