2017-02-17 40 views
1

ViewPager内にListViewを追加しました。ページが読み込まれるとすぐに最初のタブが選択され、リストの最後の項目は初めて表示されません。私は次のタブに行って戻ってくると目に見えるようになる。初めてロードされたときにlistviewのすべての項目を表示したいと思います。この問題を解決するのを手伝ってください。Android - ListViewの最後の項目は表示されません。

これは、リストビューの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"> 
<ListView 
    android:id="@+id/listview_categories" 
    android:layout_width="fill_parent" 
    android:divider="@color/light_gray_a1" 
    android:dividerHeight="0.667dp" 
    android:background="@color/white" 
    android:layout_height="fill_parent" /> 
</RelativeLayout> 
+1

あなたが代わりにfill_Parent' 'のmatch_parent''使用する必要があり、このようなゼロにそれらを設定します –

+0

match_parentを追加しても問題は解決しませんでした。 –

答えて

2

<?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"> 
<ListView 
    android:id="@+id/listview_categories" 
    android:layout_width="match_parent" 
    android:divider="@color/light_gray_a1" 
    android:dividerHeight="0.667dp" 
    android:paddingBottom="40dp" 
    android:background="@color/white" 
    android:layout_height="match_parent" /> 
</RelativeLayout> 
1

をmatch_parentするために、この、変更fill_parentのように下のパディングを追加し、私はこの問題を持っていました。ちょうど今私はそれを解決した。あなたが使用されているすべてのレイアウトでandroid:layout_weightを探し、それがandroid:layout_weight="1"またはandroid:layout_weight="0.91"のようないくつかの非ゼロ値を設定した場合、その後、

android:layout_weight="0"

関連する問題