You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change settings of app to use width wrap_content for list item
Change FlexItemViewHolder class inside com.google.android.flexbox package to show long content at 0th position
Change FlexItemAdapter class's removeItem() function inside com.google.android.flexbox package to remove 0th item from list so when we press '-' button it removes from top
Add items using "+" fab multiple times (7 times) based on list used (see attached snapshot)
Remove item using "-" fab once
Expected behavior
RecyclerView should remove simply remove item and move all items accordingly
Version of the flexbox library
0.3.1, 0.3.2
Code example/snapshots based on repro steps
class FlexItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val textList: List<String> = listOf<String>(
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy",
"It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', ",
"fdsfdsfdsfds", "gfgdfgdfgdfdf", "gdfgdfgfdgfd", "gff", "gfdgfd", "gfgdf", "gfdg")
private val textView: TextView = itemView.findViewById(R.id.textview)
fun bindTo(params: RecyclerView.LayoutParams) {
val adapterPosition = adapterPosition
textView.apply {
text = textList[adapterPosition]
setBackgroundResource(R.drawable.flex_item_background)
gravity = Gravity.CENTER
layoutParams = params
}
}
}
fun removeItem(position: Int) {
if (position < 0 || position >= layoutParams.size) {
return
}
layoutParams.removeAt(0)
notifyItemRemoved(0)
notifyItemRangeChanged(position, layoutParams.size)
}
5.
Note: if used notifyDataSetChange() instead of notifyItemRemoved works fine
The text was updated successfully, but these errors were encountered:
I'm not sure about the best solution, but firstVisiblePosition <= positionStart condition satisfies and returns from function, my guess is this condition should be firstVisiblePosition < positionStart. changing this solves the issue.
if (firstVisiblePosition <= positionStart && positionStart <= lastVisiblePosition) {
return;
}
// Assign the pending scroll position and offset so that the first visible position is
// restored in the next layout.
mPendingScrollPosition = getPosition(firstView);
if (!isMainAxisDirectionHorizontal() && mIsRtl) {
mPendingScrollPositionOffset = mOrientationHelper.getDecoratedEnd(firstView) +
mOrientationHelper.getEndPadding();
} else {
mPendingScrollPositionOffset = mOrientationHelper.getDecoratedStart(firstView) -
mOrientationHelper.getStartAfterPadding();
}
I have the same problem here!!!
(1)In addition, it only appears when the first element is deleted.
(2)You will then find that after the first element is deleted, the next line will be blank.
Issues and steps to reproduce
Using demo-playground
Expected behavior
RecyclerView should remove simply remove item and move all items accordingly
Version of the flexbox library
0.3.1, 0.3.2
Code example/snapshots based on repro steps
5.
Note: if used notifyDataSetChange() instead of notifyItemRemoved works fine
The text was updated successfully, but these errors were encountered: