2013-06-02 108 views
0

我想創建一個特定的佈局,它由2個部分組成,一個滾動視圖和一個底部的「頁腳」,但始終位於滾動視圖之上。滾動視圖內的所有內容必須可見(通過滾動)。XML佈局重疊

example

這是我當前的代碼:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    > 

<ImageView 
    android:id="@+id/imageView1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@drawable/banner" /> 

<TextView 
    android:layout_width="fill_parent" 
    android:paddingTop="1dp" 
    android:layout_height="3px" 
    android:background="#DADADA" /> 

    <RelativeLayout 
    android:id="@+id/InnerRelativeLayout" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" > 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentRight="true" 
     android:text="Start Connecting" /> 

    <Button 
     android:id="@+id/button01" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_above="@+id/button1" 
     android:layout_alignParentLeft="true" 
     android:text="First use" /> 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="20dp" 
     android:text="Welcome to ADB Wireless!" 
     android:textSize="25sp" /> 

    </RelativeLayout> 



</LinearLayout> 

但它在小屏幕上給出了一個重疊&橫向模式。我只想將2個按鈕放在「頁腳」內。謝謝!

回答

1
<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" > 

<LinearLayout 
    android:id="@+id/button_layout" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:orientation="vertical" > 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="Next" /> 

    <Button 
     android:id="@+id/button01" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="Previous" /> 
</LinearLayout> 

<ScrollView 
    android:id="@+id/scrollView" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_above="@+id/button_layout" > 
</ScrollView> 

</RelativeLayout>