PROBLEM DESCRIPTION IMAGE. THIS IS WHAT IS DESIRED (CLICK ON THE IMAGE LINK)無法顯示下方的列表視圖
我獲取來自API的數據,使一個Android應用程式的消息按鈕。每頁有X個新聞文章。可以說每頁10篇文章。所以我使用ListView和ArrayAdapter來顯示第一頁上的所有文章。我想在第10條下面的listView裏面寫上「MORE」或類似的東西,加載下一頁包含下10篇文章。現在我正在使用UI,並且按鈕不顯示在listView下面。
我想這些情況:
Layout_alignparentBotton:按鈕使用layout_alignParentBottom停留在parentBottom但名單是滾動的,去下面的按鈕爲按鈕是固定的,但名單是滾動的。預期結果
layout_below:我嘗試了layout_below並給出了列表視圖的ID。然後該按鈕根本不顯示。我不知道爲什麼。我想知道這是可能的解決方案,但我想我做錯了什麼。
這裏是我的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>
這是什麼使ListView控件如果這有助於(名單的個別項目的XML):
<?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>
謝謝,它工作。 – Aman
請給別人的引用,當使用別人的答案.https://stackoverflow.com/questions/5123675 /查找出-IF-列表視圖 - 是 - 滾動到的底部 –