Height of RecyclerView with Flexboxlayoutmanager does not work correctly when recyclerview is wrap_content
wealive opened this issue · comments
- I have searched existing issues and confirmed this is not a duplicate
Issues and steps to reproduce
I got a NestScrollView with 3 RecyclerView in it.And each recyclerview had a "loadmore"button,when tapped, add 50 new item into it,but the recycler view does not display correct ,only 10or more added,but I expect 50
Expected behavior
Version of the flexbox library
3.0.0
Link to code
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:overScrollMode="never"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:background="@drawable/bg_white_vp_8"
android:orientation="vertical"
android:paddingBottom="12dp">
<TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="20dp"
android:includeFontPadding="false"
android:text="常考词汇"
android:textColor="#0099ff"
android:textSize="13sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_1st"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:nestedScrollingEnabled="false"
android:paddingEnd="12dp" />
<RelativeLayout
android:id="@+id/tv_more_1st"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:background="@drawable/aibk_bg_vocab_select">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:drawableStart="@mipmap/aibk_icon_arrow_down"
android:drawablePadding="6dp"
android:gravity="center"
android:includeFontPadding="false"
android:text="加载更多"
android:textColor="#0099ff"
android:textSize="12sp" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="8dp"
android:includeFontPadding="false"
android:text="次常考词汇"
android:textColor="#0099ff"
android:textSize="13sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_2nd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:nestedScrollingEnabled="false" />
<RelativeLayout
android:id="@+id/tv_more_2nd"
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="#ccebff">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:drawableStart="@mipmap/aibk_icon_arrow_down"
android:drawablePadding="6dp"
android:gravity="center"
android:includeFontPadding="false"
android:text="加载更多"
android:textColor="#0099ff"
android:textSize="12sp" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="8dp"
android:text="不常考词汇"
android:textColor="#0099ff"
android:textSize="13sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_3rd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:nestedScrollingEnabled="false" />
<RelativeLayout
android:id="@+id/tv_more_3rd"
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="#ccebff">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:drawableStart="@mipmap/aibk_icon_arrow_down"
android:drawablePadding="6dp"
android:gravity="center"
android:includeFontPadding="false"
android:text="加载更多"
android:textColor="#0099ff"
android:textSize="12sp" />
</RelativeLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
rv_1st.layoutManager = FlexboxLayoutManager(
requireContext(), FlexDirection.ROW,
FlexWrap.WRAP
).apply {
isAutoMeasureEnabled=true
alignItems = AlignItems.FLEX_START
}
rv_1st.adapter = adapter
adapter.setNewData(it.data.FirstVocabList)
我也遇到了这个问题,请问后来有解决吗?
I also encountered this problem. Was it resolved later?
我也遇到了这个问题,请问后来有解决吗?
I have the same problem, is there any way to solve it?
Same problem here !
I am having the same problem