Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 回收查看包装内容问题_Android - Fatal编程技术网

Android 回收查看包装内容问题

Android 回收查看包装内容问题,android,Android,我面临着一个奇怪的问题,我的Recycleview在高度上是包装内容,但它占据了整个屏幕的高度,而我的内容只占据了一半的屏幕空间。 我读到这是一个bug,它在23.2.1中得到了修复。我正在使用:- compile 'com.android.support:appcompat-v7:24.1.1' compile 'com.android.support:recyclerview-v7:24.1.1' 在xml中,我也没有添加任何特定的内容:- <?xml version="1.0" e

我面临着一个奇怪的问题,我的Recycleview在高度上是包装内容,但它占据了整个屏幕的高度,而我的内容只占据了一半的屏幕空间。 我读到这是一个bug,它在23.2.1中得到了修复。我正在使用:-

compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
在xml中,我也没有添加任何特定的内容:-

<?xml version="1.0" encoding="utf-8"?>



我最近遇到了同样的问题,这是一个bug; 我用简单的方法解决了这个问题: 将任何线性布局或任何视图放置在recyclerview的正下方,并将其设置为“不可见”,这将帮助回收者适应包装高度测量


第二个解决方案是定制线性布局,并在recyclerview中使用它。setlayoutmanager

我最近遇到了同样的问题,这是一个bug; 我用简单的方法解决了这个问题: 将任何线性布局或任何视图放置在recyclerview的正下方,并将其设置为“不可见”,这将帮助回收者适应包装高度测量

第二个解决方案是制作自定义线性布局,并在recyclerview.setlayoutmanager中使用它

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_marginBottom="@dimen/margin_10"
    android:layout_marginLeft="@dimen/margin_20"
    android:layout_marginRight="@dimen/margin_20"
    android:layout_marginTop="@dimen/margin_10"
    android:layout_weight="1">

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swipe"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/recycleview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#FF0000" />
    </android.support.v4.widget.SwipeRefreshLayout>

    <include layout="@layout/layout_circular_progress_bar" />
</FrameLayout>