RecycleView为项目设置了错误的高度

Art*_*tem 15 android android-recyclerview

我为我搜索答案,但找不到工作答案.查看我的项目时出现奇怪错误RecycleView: 在此输入图像描述

我对RecycleView使用不同的视图.

我尝试使用此代码:

mLayoutManager.setAutoMeasureEnabled(true); // false doesn't work too
Run Code Online (Sandbox Code Playgroud)

但它对我没有帮助.

UPD 1我忘记了这个,对不起.当我启动应用程序时,我没有错误(像图像上的正常项目),但当我开始滚动我的RecycleView问题时)

UPD 2我回到了 compile 'com.android.support:recyclerview-v7:23.1.1',但它没有帮助我(.所以我添加代码和xml与mey RecycleView,我希望你帮助我.

XML:

<android.support.v7.widget.RecyclerView
    android:id="@+id/dashboard_recycle_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipToPadding="false"
    android:scrollbars="none" />
Run Code Online (Sandbox Code Playgroud)

和代码:

    mRecyclerView = (RecyclerView) parent.findViewById(R.id.dashboard_recycle_view);
    mLayoutManager = new LinearLayoutManager(getContext());
    mLayoutManager.setAutoMeasureEnabled(false);
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.setHasFixedSize(false);
    mRecyclerView.setAdapter(mRecycleAdapter);
Run Code Online (Sandbox Code Playgroud)

Pau*_*ues 15

设置wrap_content为recyclerview和viewholder布局父级.这对我有用.