有人知道这样的布局如何实现,要能自动适配屏幕的。
也就是顶部固定高度的LinearLayout,底部是一个LinearLayout,中间的ScrollView高度是自动适配的,就是中间的那个属性该要怎么设置?
想了好久没有想出来。有做UI的大侠知道一下嘛?

解决方案 »

  1.   

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent" android:layout_height="fill_parent">
      
    <LinearLayout
    android:id="@+id/top"
    android:background="#ff303030"
    android:layout_width="fill_parent"
       android:layout_height="50dp">
    </LinearLayout><LinearLayout
    android:id="@+id/bottom"
    android:background="#ff303030"
    android:layout_width="fill_parent"
    android:layout_height="50dp"
       android:layout_alignParentBottom="true">
    </LinearLayout>
    <ScrollView 
        android:id="@+id/center"
    android:background="#ffa0a0a0"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@+id/top"
    android:layout_above="@+id/bottom"
    ></ScrollView>
    </RelativeLayout>试试这个,是否符合需要~~
      

  2.   

    中间的布局 加一个比重试试 android:layout_weight="1"
      

  3.   

    这个肯定不行,上下在不同长宽比例的屏幕下,上下两部分的LinearLayout高度是变化的。