RecyclerView supported wrap_content? Not quite!

As per reported in this stackoverflow and by Yigit in Google Issue Tracker, beginning Android Studio 23.2.1 (March 2016), RecyclerView now supported the wrap_content. Hurray to many! Little did people discover this…

So what’s the problem?

Do check the below RecyclerView (with layout_height = wrap_content) and see how it animates when the items got removed.

During removal, the animation looks weird, but insertion is okay. It’s not easily realize the problem from the quick animation and small row.

Let’s amplify the issue.

To make things clearer. What I did is

  • slow down the animation
  • make the row ticker (with bigger font)
  • differentiate the background of recycler-view (grey) and background of the layout (black).

The result as below

--

--