Saturday, 24 November 2018

Increase cell width in a RecyclerView with GridLayoutManager

I have a RecyclerView with a GridLayoutManager with spanCount=2 and a Vertical orientation.

My items are correctly displayed as the image below:

Now I need to add an animation that when a click on one of the items, let's say number "3", that item increases its width and push the item next to it (in this example, number "4") partially outside the parent/screen.

Visually, it would be something like this:

To expand the item I am setting the visibility to VISIBLE to a view inside the item and to collapse it, set the visibility to GONE.

At the moment, I am able to show and hide that view, but it only takes the space of the item, it does increase the width pushing the item next to it.

So my questions are:

  • Is this possible to use the default GridLayoutManager for this?
  • What would be a good approach to achieve this?


from Increase cell width in a RecyclerView with GridLayoutManager

No comments:

Post a Comment