2011-05-12 3 views
1

Voici mon code XML. S'il vous plaît ignorer les couleurs. Je les ai mis là pour testerProblème de mise en page dans Android

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ff0000"> 
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="match_parent" android:background="#ffffff"> 
     <TabHost android:id="@+id/distributionTabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> 
      <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> 
       <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="match_parent" android:background="#00ff00" /> 
       <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="match_parent" android:background="#ff0000"> 
        <LinearLayout android:id="@+id/ITCCGListContainer" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"> 
         <ListView android:id="@+id/ITCCGList" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" 
          android:drawSelectorOnTop="false" android:background="#00ff00"/> 
        </LinearLayout> 
       </FrameLayout> 
      </LinearLayout> 
     </TabHost> 
    </LinearLayout> 
</ScrollView> 

Lorsque j'utilise cela pour une activité, la hauteur de la listview est très faible et non occupant l'espace vide restant. Ce que je veux, c'est que la Listview occupe autant d'espace que nécessaire pour son contenu et que l'ensemble de l'activité défile. Pour cela, j'ai joint le tout dans un scrollview.

Merci

Répondre

0

Vous devez définir la propriété android:fillViewport="true" pour votre ScrollView, donc pour l'adapter à la partition de l'écran dédié pour votre Activity.