Christophe Beyls
Jul 10, 2017 · 1 min read

Two things are really wrong with your solution:

  1. Don’t create a custom RecyclerView. This forces the developers to change their layouts and prevents them from using your library in combination with other custom RecyclerViews. Contrary to ListView, RecyclerView is designed to be modular so you can easily register a custom LayoutManager and one or more ItemDecoration, OnScrollListener, and more. If your solution needs more than one of these classes, you can create a standalone component which works similarly to SnapHelper and registers all classes in a single attachToRecyclerView() method.
  2. To resize items, you are changing LayoutParams of visible views on each frame which is really bad for performance and should be strictly avoided. I would rather recommend that you offset the view positions and play with clipping to cover their top or bottom parts. You can also cross-fade cells between an expanded and a collapsed state.

    Christophe Beyls

    Written by

    Android developer from Belgium, blogging about advanced programming topics.

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade