2012-08-17 114 views
0

我正在進行一些scrollview和framelayout的戰鬥。儘管嘗試了很多事情,無論我做什麼,scrollview似乎都會填充父級,並將一些內容粘貼在framelayout後面。 我想要的是底部的framelayout和scrollview來填充頂部。任何人都可以指出我在這裏犯的愚蠢錯誤嗎? 我嘗試了這裏建議的Layout issue on Android with FrameLayout and ScrollView,但沒有這樣做。ScrollView在framelayout後面滾動

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/quizresultlayout" 
style="@style/Activity" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" > 

<ScrollView 
    android:id="@+id/resultscroll" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_above="@+id/frameLayout1" 
    android:fillViewport="true" > 

    <LinearLayout 
     android:id="@+id/sublayout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 

     <TextView 
      android:id="@+id/tvResultMsg" 
      style="tvtemplatemedium" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:tag="@string/quizresults_CongratsMsg" 
      android:text="@string/quizresults_CongratsMsg" /> 

     <TableLayout 
      android:id="@+id/resultable" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" > 
     </TableLayout> 
    </LinearLayout> 
</ScrollView> 

<FrameLayout 
    style="@style/bottomframe" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentRight="true" > 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="92dp" > 

     <ImageButton 
      android:id="@+id/btnstartquiz" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:layout_alignParentRight="true" 
      android:src="@drawable/play" /> 

     <ImageButton 
      android:id="@+id/btnRptCard" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:layout_alignParentLeft="true" 
      android:src="@drawable/chart" /> 

     <ImageButton 
      android:id="@+id/btnTrunk" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:layout_centerHorizontal="true" 
      android:src="@drawable/play" /> 
    </RelativeLayout> 
</FrameLayout> 

</RelativeLayout> 

回答

2

這樣做:

變化根RelativeLayout的到的LinearLayout。

設置了滾動機器人:layout_height =「0dp」

添加到滾動型機器人:layout_weight =「1」 < - 這會讓你的滾動型填充剩餘空間,並會在底部推的FrameLayout。

+0

工作就像一個魅力!我之前嘗試過線性佈局,但我想我沒有設置權重。認爲這是愚蠢的。非常感謝您的幫助! – tobylang 2012-08-18 03:31:15

+0

謝謝,它是一個救命的人,我在Google之前一個小時搜索了一下。 – 2012-09-07 21:53:39