Je veux que mon activité entière défile à la fois, mais le ListView qui est incorporé dans mon ScrollView ne s'élargira pas. Je vois juste la première rangée, mais je peux faire défiler les autres rangées, en faisant défiler la liste. Ce que je besoin est pour le listView de se développer en hauteur pour tous les éléments qu'il contient sont affichés sans avoir à faire défiler la listview, seule la principale ScrollView ...Android: comment faire un listview remplir son parent sans défilement?
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:orientation="vertical"
android:layout_weight="1" >
<LinearLayout
android:id="@+id/header_Layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
...
</LinearLayout>
<TextView
android:id="@+id/comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="@drawable/gradient_background"
android:text="@string/comments"
android:textColor="#000000"
android:textStyle="bold" >
</TextView>
<ListView
android:id="@+id/commentsListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill"
android:divider="@drawable/gradient_divider"
android:dividerHeight="1dp" />
</LinearLayout>
</ScrollView>
Vous pouvez vous référer à cet article http://stackoverflow.com/questions/3495890/how-can-i-put-a-listview-into-a-scrollview-without-it-collapsing –