DatVM DatVM - 1 year ago 143
Android Question

How to make layout with View fill the remaining space?

I'm designing my application UI. I need a layout looks like this:

Example of desired layout

(< and > are Buttons). The problem is, I don't know how to make sure the TextView will fill the remaining space, with two buttons have fixed size.

If I use fill_parent for Text View, the second button (>) can't be shown.

How can I craft a layout that looks like the image?

Answer Source

Answer from woodshy worked for me, and it is simpler than the answer by Ungureanu Liviu since it does not use RelativeLayout. I am giving my layout for clarity:


        android:layout_width = "80dp"
        android:layout_weight = "0"
        android:layout_height = "wrap_content"
        android:layout_width = "fill_parent"
        android:layout_height = "wrap_content"
        android:layout_weight = "1"/>
        android:layout_width = "80dp"
        android:layout_weight = "0"
        android:layout_height = "wrap_content"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download