带有CardView的Android ListView:滚动时未完全显示Last Card

sri*_*nij 2 android listview android-layout android-listview android-cardview

在此输入图像描述

我创建了一个ListView,我已经添加了CardView.

正如您在图像中看到的,当我开始滚动时,ListView中的最后一张卡未完全显示.它会向上滚动,但它不会位于Android底部的Android导航栏上方.我一直在测试HTC One M8.

这是ListView:

<?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="fill_parent"
    android:orientation="vertical">
    <ListView
        android:id="@+id/wanna_list"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:divider="@null"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

这是我扩展并设置到listview适配器的CardView:

<?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.support.v7.widget.CardView
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:id="@+id/cv"
        android:foreground="?android:attr/selectableItemBackground"
        android:clickable="true"
        card_view:cardCornerRadius="6dp"
        card_view:cardUseCompatPadding="true"
        card_view:cardElevation="2dp">
    <!-- compat padding is required if using AppCompat -->

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="16dp" >

            <ImageView
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:id="@+id/thumbnail"
                android:layout_alignParentLeft="true"
                android:layout_alignParentTop="true"
                android:layout_marginRight="16dp"
                android:src="@drawable/india"
                android:scaleType="centerCrop" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/firstLine"
                android:layout_toRightOf="@+id/thumbnail"
                android:layout_alignParentTop="false"
                android:textSize="20sp"
                android:text="Tennis with Peter"
                android:layout_alignTop="@+id/thumbnail" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/secondLine"
                android:layout_below="@+id/firstLine"
                android:text="10 Oct at 7pm"
                android:layout_alignLeft="@+id/firstLine" />

            <Button
                android:layout_width="180dp"
                android:layout_height="wrap_content"
                android:text="YES"
                android:id="@+id/button3"
                android:layout_alignParentBottom="true"
                android:layout_alignParentLeft="true"
                android:layout_alignLeft="@+id/thumbnail" />

            <Button
                android:layout_width="60dp"
                android:layout_height="wrap_content"
                android:text="NO"
                android:id="@+id/button4"
                android:layout_toRightOf="@+id/button3"
                android:layout_alignBottom="@+id/button3"
                android:layout_alignParentRight="true"
                android:layout_alignParentEnd="false" />

        </RelativeLayout>

    </android.support.v7.widget.CardView>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我还尝试了我的卡片视图布局而没有将其包装在LinearLayout中,但它仍然不起作用.

布局xml中是否有一个设置来处理这个问题?

提前致谢.

cur*_*ind 5

 android:layout_marginBotton=" "
Run Code Online (Sandbox Code Playgroud)

添加保证金底部应尝试一次.