PROBLEM DESCRIPTION IMAGE. THIS IS WHAT IS DESIRED (CLICK ON THE IMAGE LINK)Impossible d'afficher le bouton ci-dessous une vue liste
J'extraction de données à partir d'une API et de faire une application de nouvelles applications. Chaque page a X nombre d'articles de nouvelles. Disons 10 articles par page. Donc j'utilise un ListView et un ArrayAdapter pour montrer tous les articles sur la 1ère page. Je veux à la fin du 10ème article ci-dessous listView qui dit "PLUS" ou quelque chose comme ça qui charge la page suivante contenant les 10 prochains articles. Maintenant, je travaillais sur l'interface utilisateur et le bouton ne s'affiche pas en dessous de la liste.
J'ai essayé ces scénarios:
Layout_alignparentBotton: Le bouton est bloqué à l'aide parentBottom layout_alignParentBottom mais la liste est et va scrollable sous le bouton que le bouton est fixe, mais la liste est scrollable. Résultat attendu
layout_below: J'ai essayé layout_below et j'ai donné l'ID de la vue liste. Ensuite, le bouton ne s'affiche pas du tout. Je ne sais pas pourquoi. Je me demandais cela comme la solution possible, mais je suppose que je fais quelque chose de mal.
Voici mon XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<Button
android:id="@+id/moreButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/list"
android:text="More" />
</RelativeLayout>
Ce qui fait l'listView si cela aide (Le XML de l'élément individuel de la liste):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/customListViewID"
android:background="@drawable/background_shape_adapter"
android:orientation="horizontal">
<ImageView
android:id="@+id/newsThumbnailImage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:orientation="vertical"
android:paddingStart="10dp"
android:paddingTop="10dp">
<TextView
android:id="@+id/titleNewsTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="3"
android:text="Title Of News"
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Small"
android:textColor="#000" />
<TextView
android:id="@+id/newsSnippetTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="2"
android:text="Content Snippet"
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Small.Inverse"
android:textColor="@color/black_overlay" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Merci, cela a fonctionné – Aman
S'il vous plaît donner la référence à d'autres en utilisant la réponse de quelqu'un d'autre.https: //stackoverflow.com/questions/5123675/find-out-if-listview-is-scrolled-to-the-bottom –