flexbox-layout
flexbox-layout copied to clipboard
Drop frame and warning ARN when using FlexlayoutManager with Recyclerview
I have a problem when using FlexlayoutManager in Recyclerview
- I have a list of image with size 300 items
- The size of the image is different
- Everything was fine when I scrolled to 100 items but the problem occurred when I scrolled to about 200 items. Appear warning ARN and Drop frame terrible
Issues and steps to reproduce
This is the code to display the item
val lp = rlLayout.layoutParams
lp.width = item.width
lp.height = item.height
if (lp is FlexboxLayoutManager.LayoutParams) {
lp.flexGrow = 1f
}
glide
.load(item.url_w)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.transition(DrawableTransitionOptions.withCrossFade(200))
.error(context.resources.getDrawable(R.drawable.ic_error, null))
.centerCrop()
.into(imgItem)
This is code XML
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="photoItem"
type="com.hunger.projectbeauty.data.local.entity.PhotoEntity" />
</data>
<RelativeLayout
android:id="@+id/rlLayout"
android:layout_width="0dp"
android:layout_height="0dp">
<ImageView
android:id="@+id/imgItem"
android:background="@color/grey_20"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:layout_margin="1dp"
android:contentDescription="@string/app_name"/>
<LinearLayout
android:id="@+id/llTitleBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/overlay_dark_60"
android:gravity="end"
android:visibility="invisible">
<TextView
android:id="@+id/tvTitleImg"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:ellipsize="end"
android:maxLength="9"
android:text="@{photoItem.title}"
android:textColor="@color/white"
android:textSize="@dimen/text_medium"
android:textStyle="bold" />
<ImageView
android:id="@+id/imgFav"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:contentDescription="@string/app_name"
android:src="@{photoItem.like==1 ? @drawable/ic_favorites :@drawable/ic_favorite_border}" />
</LinearLayout>
</RelativeLayout>
</layout>
Contact with me
I hope you maybe contact with me via Skype : nvd3012 or email [email protected] so I can send you the source code.
Version of the flexbox library
2.0.1