Je veux avoir un listview contenant du contenu. Et en dessous, lorsque vous faites défiler jusqu'à la fin de la liste, un nouvel en-tête serait affiché suivi d'une nouvelle vue de liste. Est-ce possible? // Éditer Les deux listview doivent avoir un layout xml différent.Listview ci-dessous listview android
J'ai essayé de mettre la deuxième liste dans une vue de la première. Mais alors la deuxième liste est petite.
Voici ma mise en page
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<LinearLayout android:id="@+id/header"
android:background="@drawable/app_topbar" android:layout_width="fill_parent"
android:orientation="horizontal" android:layout_height="wrap_content"
android:layout_alignParentTop="true">
<TextView android:text="@string/headline_notused"
android:gravity="center" android:textSize="24sp" android:textStyle="bold"
android:textColor="@color/txtcolor" android:layout_width="fill_parent"
android:layout_height="fill_parent"></TextView>
</LinearLayout>
<ProgressBar android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_below="@+id/header"
android:visibility="gone" style="?android:attr/progressBarStyleHorizontal"
android:id="@+id/progressbarHorizontal" />
<ListView android:id="@+id/notUsedList" android:divider="@android:color/transparent"
android:dividerHeight="5dip" android:layout_height="wrap_content"
android:layout_marginBottom="5dip" android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_below="@+id/progressbarHorizontal"></ListView>
<LinearLayout android:orientation="vertical"
android:layout_below="@+id/notUsedList" android:background="@drawable/app_background"
android:layout_marginBottom="55dip" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:id="@+id/myUsedHeader"
android:background="@drawable/app_topbar" android:layout_marginTop="10dip"
android:layout_width="fill_parent" android:orientation="horizontal"
android:layout_height="wrap_content" android:layout_alignParentTop="true">
<TextView android:text="@string/headline_used" android:gravity="center"
android:textSize="24sp" android:textStyle="bold" android:textColor="@color/txtcolor"
android:layout_width="fill_parent" android:layout_height="fill_parent"></TextView>
</LinearLayout>
<ListView android:id="@+id/usedList"
android:divider="@android:color/transparent" android:dividerHeight="5dip"
android:layout_height="fill_parent" android:layout_width="fill_parent"></ListView>
</LinearLayout>
</RelativeLayout>
Vous définissez la mise en page pour la liste et les éléments de liste lorsque vous initiez l'adaptateur. Je ne comprends pas le problème ... votre première liste n'a rien à voir avec le second sauf pour le dire quand il atteint le dernier élément de la liste. – rf43
Je ne comprends pas votre ned: voulez-vous remplacer votre listview par un nouveau ou faire en sorte que votre listview précédente soit plus longue en ajoutant des éléments avec une disposition de ligne différente? –
rallonge ma listview précédente en ajoutant des éléments avec une disposition de ligne différente. J'ai également besoin d'ajouter un nouvel en-tête. Désolé s'il est difficile à comprendre :) – Casper