Android listview pas de défilement
j'ai une mise en page dont le départ tag(balise parent est ) est
<scroll view
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
plus tard, j'ai beaucoup d'images , textView , Modifier le texte et d'autres choses, et enfin une vue de liste.
j'ai défini la hauteur de la listview comme 230dp prescrits pour moi.
le truc, c'est toute la mise en page est de défilement de nice, mais le contenu à l'intérieur de la liste n'est pas défilement individuellement . de cette façon, le xml ressemble...
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="BISCOOT"
android:textSize="25dp"
android:background="@drawable/item_bg_light"
android:textColor="@android:color/white"
android:gravity="center"/>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="200dp" android:background="#ff000000">
<ImageSwitcher android:id="@+id/switcher1" android:layout_width="fill_parent"
android:layout_height="200dp"
android:layout_alignParentLeft="true" android:layout_alignParentRight="true" >
</ImageSwitcher>
<ProgressBar
android:id="@+id/progressBar2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_centerHorizontal="true"
/>
<ImageButton android:id="@+id/imageButton1" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:src="@android:drawable/ic_media_ff" />
<ImageButton android:id="@+id/imageButton2" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_alignParentLeft="true"
android:layout_alignTop="@+id/imageButton1" android:src="@android:drawable/ic_media_rew" />
</RelativeLayout>
<TextView android:layout_width="fill_parent"
android:layout_height="30dp"
android:text="Latest headLines"
android:background="@drawable/item_bg_light"
android:textColor="@android:color/white"
android:gravity="center"/>
<ProgressBar
android:id="@+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:scrollbarFadeDuration="0"
android:scrollbarStyle="outsideOverlay"
android:smoothScrollbar="true"
android:layout_height="260dp">
</ListView>
</LinearLayout>
<!--
<TextView android:layout_width="fill_parent"
android:layout_height="30dp"
android:text="Heroin On the Rocks"
android:background="@drawable/item_bg_light"
android:textColor="@android:color/white"
android:gravity="center"/>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="200dp" android:background="#ff000000">
<ImageSwitcher android:id="@+id/switcher2" android:layout_width="fill_parent"
android:layout_height="200dp"
android:layout_alignParentLeft="true" android:layout_alignParentRight="true" />
<ImageButton android:id="@+id/imageButton3" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:src="@android:drawable/ic_media_ff" />
<ImageButton android:id="@+id/imageButton4" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_alignParentLeft="true"
android:layout_alignTop="@+id/imageButton1" android:src="@android:drawable/ic_media_rew" />
</RelativeLayout>
-->
<TextView android:layout_width="fill_parent"
android:layout_height="30dp"
android:text="Watch Movies"
android:background="@drawable/item_bg_light"
android:textColor="@android:color/white"
android:gravity="center"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="100dp" android:orientation="horizontal"
android:weightSum="6"
>
<ImageView
android:layout_height="100dp"
android:layout_width="wrap_content" android:layout_weight="1"
android:layout_marginLeft="2dp" android:layout_marginRight="2dp"
android:id="@+id/watchmoviesimg1"
/>
<ImageView android:layout_height="100dp"
android:layout_width="wrap_content" android:layout_weight="1"
android:layout_marginLeft="2dp" android:layout_marginRight="2dp"
android:id="@+id/watchmoviesimg2"/>
<ImageView android:layout_height="100dp" android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_marginLeft="2dp" android:layout_marginRight="2dp"
android:id="@+id/watchmoviesimg3"/>
<ProgressBar
android:id="@+id/progressBar3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<ImageView android:layout_height="100dp" android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_marginLeft="2dp" android:layout_marginRight="2dp"
android:id="@+id/watchmoviesimg4"/>
<ImageView android:layout_height="100dp" android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_marginLeft="2dp" android:layout_marginRight="2dp"
android:id="@+id/watchmoviesimg5"/>
<ImageView android:layout_height="100dp" android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_marginLeft="2dp" android:layout_marginRight="2dp"
android:id="@+id/watchmoviesimg6"/>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="200dp"
android:orientation="vertical"
>
<TextView android:layout_width="fill_parent"
android:layout_height="30dp"
android:text="Photo Stories"
android:background="@drawable/item_bg_light"
android:textColor="@android:color/white"
android:gravity="center"/>
<ProgressBar
android:id="@+id/progressBar4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<ImageView
android:id="@+id/photostoryimageview1"
android:layout_height="200dp" android:layout_weight="1"
android:layout_width="fill_parent"
/>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="200dp"
android:orientation="vertical"
>
<TextView android:layout_width="fill_parent"
android:layout_height="30dp"
android:text="Star Special"
android:background="@drawable/item_bg_light"
android:textColor="@android:color/white"
android:gravity="center"/>
<ProgressBar
android:id="@+id/progressBar5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
<ImageView
android:id="@+id/starSpecialimageView1"
android:layout_height="200dp" android:layout_weight="1"
android:layout_width="fill_parent"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
Je pense que ce n'est pas une bonne idée de mettre Listview à l'intérieur d'un ScrollView
une vue de liste a construit dans le défilement pourquoi êtes-vous de mettre un scrol vue sur le sommet de
parce que ma mise en page est longue , l'ensemble de xml doit avoir un parent scrolll , et la liste doit avoir une personne de défilement à l'intérieur
Mais, il semble que votre xml ne contient que des
Vous n'avez pas capable de faire ScrollViw et ListView dans un layout. Si vous avez mis le ScrollView puis ListView ne fonctionnera pas et si vous ne mettez pas le ScrollView puis contrôle ListView travail pour les faire défiler.
une vue de liste a construit dans le défilement pourquoi êtes-vous de mettre un scrol vue sur le sommet de
parce que ma mise en page est longue , l'ensemble de xml doit avoir un parent scrolll , et la liste doit avoir une personne de défilement à l'intérieur
Mais, il semble que votre xml ne contient que des
ListView
lui-même. Alors, pourquoi il doit être à l'intérieur d'un ScrollView
avez-vous plus de contenu dans votre fichier XML? Je veux dire, posté code xml si à part entière. Ou que tu viens de poster le code pertinent?Vous n'avez pas capable de faire ScrollViw et ListView dans un layout. Si vous avez mis le ScrollView puis ListView ne fonctionnera pas et si vous ne mettez pas le ScrollView puis contrôle ListView travail pour les faire défiler.
OriginalL'auteur Pranav | 2012-09-05
Vous devez vous connecter pour publier un commentaire.
Simplement, supprimer la
ScrollView
à partir de votre mise en page. Et, faire laLinearLayout
en tant que parent. Et, essayez d'exécuter votre application. Faire défiler la liste.Parce que le
ListView
classe implémente sa propre défilement et il ne reçoit pas de gestes car ils sont tous manipulés par le parentScrollView
je vous recommande fortement pour simplifier votre mise en page en quelque sorte. Par exemple, vous pouvez ajouter des points de vue que vous souhaitez faire défiler à l'ListView
que les en-têtes ou pieds de page.Ont un coup d'oeil à cette
Mise à jour
Prendre l'un des parents de mise en page avec deux enfants. Et, dans une mise en page, il doit contenir
ScrollView
avec votre contenu. Et, sur un autre modèle contenir votreListView
Essayer comme cette qu'Il a fait comme ça.merci pour votre soutien butwith ces énormes xml , à l'intérieur de parent donnant linéaire de la mise en page , puis faites défiler la vue , puis de nouveau un linéaire de la mise en page .. ce qui donne une force à proximité
Post le logcat ici
OriginalL'auteur Praveenkumar
juste ajouter ceci, alors cela fonctionnera.
OriginalL'auteur belphegor
Vous ne devez pas mettre une liste à l'intérieur d'un ScrollView parce que la liste de la classe implémente sa propre défilement et il ne reçoit pas de gestes car ils sont tous manipulés par le parent ScrollView.
Make Parent Linéaire de la Mise en page, puis deux enfant de mise en page est faites défiler la vue et l'un linearlayout . mettre listview dans la deuxième paquebot de mise en page;
cela semble une bonne idée , laissez-moi essayer en premier
OriginalL'auteur Chirag
Vous n'avez pas capable de faire ScrollViw et ListView dans un layout. Si vous avez mis le ScrollView puis ListView ne fonctionnera pas et si vous ne mettez pas le ScrollView puis contrôle ListView travail pour les faire défiler.
Mise à JOUR
Même si la liste à l'intérieur de scrollview ou le scrollview à l'intérieur de listview, les deux fonctionneront. Vous avez besoin de traiter sa touche en conséquence.
OriginalL'auteur iDroid Explorer
Essayer en dessous de la classe, il peut vous aider à travailler avec ListView à l'intérieur de ScrollView
Utility.java
Enfin utiliser cette ligne juste après le réglage de l'adaptateur à votre listview -
Utilitaire.setListViewHeightBasedOnChildren(your_listview);
OriginalL'auteur Chirag Jain
Vous ne pouvez pas ajouter une ListView dans un rouleau de Vue, comme l'affichage de la liste également les parchemins et il y aurait un problème de synchronisation entre listview faites défiler et faites défiler la vue de défilement. Vous pouvez faire un CustomList de Visualiser et d'ajouter cette méthode.
OriginalL'auteur Gopal Srivastava
J'ai trouvé la solution pour se débarrasser de ce problème de défilement. En fait l'utilisation de listview dans le scrollview, parfois, pourrait créer des problèmes.
On pourrait supprimer cette scrollview et il suffit de prendre une listview. Maintenant, créez trois de mise en page de la première page principale avec listview (qui nous voulons montrer liste ci-dessus), le second en-tête et le troisième pour le pied de page (qui nous sommes pour montrer liste ci-dessous) et enfin ajouter un en-tête et pied de page dans la liste. Cela va ajouter un en-tête et pied de page comme un élément de la liste.
Remarque: Cette solution est pour la petite liste de 2 ou 3 éléments dans la liste.
OriginalL'auteur Chirag Jain