Using the relative layout, the following view settings properties Layout_alignparentbottom:true, placed at the bottom,
The middle view needs to be set separately
Android:layout_above= ""
Android:layout_below= ""
This way the middle view automatically fills in the remainder of the middle and its height attribute is invalidated.
:
Layout file:
1 <Relativelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"2 Xmlns:tools= "Http://schemas.android.com/tools"3 Android:layout_width= "Match_parent"4 Android:layout_height= "Match_parent"5 Android:background= "@drawable/bg_2"6 android:orientation= "vertical" >7 8 <TextView9 Android:id= "@+id/tv1"Ten Android:layout_width= "Match_parent" One Android:layout_height= "50DP" A Android:background= "#20Ff0000" - android:gravity= "Center" - Android:text= "@string/top" the Android:textcolor= "#ffffff" /> - - <TextView - Android:id= "@+id/v2" + Android:layout_width= "Match_parent" - Android:layout_height= "Match_parent" + Android:layout_above= "@+id/v3" A Android:layout_below= "@+id/tv1" at Android:background= "#7f00ff00" - android:gravity= "Center" - Android:text= "@string/middle" - Android:textcolor= "#ffffff" /> - - <TextView in Android:id= "@+id/v3" - Android:layout_width= "Match_parent" to Android:layout_height= "50DP" + Android:layout_alignparentbottom= "true" - Android:background= "#700000ff" the android:gravity= "Center" * Android:text= "@string/bottom" $ Android:textcolor= "#ffffff" />Panax Notoginseng - </Relativelayout>
Upper and lower layout, upper and lower height designation, middle adaptive (left and right)