2010-08-20 7 views
5

Ho un layout che ha solo una ScrollView visibile. Ha una struttura relativa come il suo bambino. Questo layout ha molti altri layout (principalmente viste di testo) come i suoi figli. Quando il testo non è abbastanza grande, la vista di scorrimento non si espande per adattarsi all'intero schermo. Invece, mostra una lacuna nella parte inferiore in cui lo sfondo mostra. Ho provato a impostare fillViewPort=true sullo ScrollView, ma ho appena creato il primo layout figlio (RL1) per riempire lo schermo.Come rendere ScrollView con un RelativeLayout con più layout figlio riempire lo schermo?

<?xml version="1.0" encoding="utf-8"?> 
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="@drawable/background_image"> 

    <ProgressBar android:id="@+id/progressBar" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:visibility="gone"/> 

    <ScrollView 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:fillViewPort="true" 
     android:scrollbars="none"> 

    <RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:paddingTop="10px"> 

     <RelativeLayout android:id="@+id/list" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:paddingTop="10px"> 

     <!-- This layout is filling the screen if I set fillViewPort="true" --> 
     <RelativeLayout android:id="@+id/RL1" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"> 

      <!--TextViews and ImageViews --> 

     </RelativeLayout> 

     <RelativeLayout android:id="@+id/RL2" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"> 

      <!--TextViews and ImageViews --> 

     </RelativeLayout> 

     <RelativeLayout android:id="@+id/RL3" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" > 

      <!--TextViews and ImageViews --> 

     </RelativeLayout> 

     <RelativeLayout android:id="@+id/RL4" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"> 

      <!--TextViews and ImageViews --> 

     </RelativeLayout> 

    </RelativeLayout> 

    </RelativeLayout> 

    </ScrollView> 

</FrameLayout> 

risposta

5

fillViewPort dovrebbe essere fillViewport

Problemi correlati