Reputation: 1376
I have a relative layout. For simplicity, there is an ImageView
, EditText
, and Button
:
ImageView
is a banner with a fixed heightEditText
where android:layout_width="fill_parent"
Button
with a fixed width and heightThe 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?
Upvotes: 29
Views: 16500
Reputation: 8790
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.
Upvotes: 3
Reputation: 12045
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"
.
Upvotes: 68