An Android RecyclerView List with items that can scroll to reveal more content
An Android RecyclerView List with items that can scroll to reveal more content
An Android RecyclerView List with items that can scroll to reveal more content on the side. This view has been inspired by the one found in the Reddit News App.
[]
The view has been created using standard views now available with Android Lollipop and its compatibility libraries. The list is a RecyclerView with a LinearLayoutManager. Each item in the list is essentially a ViewPager with two views; a CardView and FrameLayout with three buttons.
Everything else can be used normally except the RecyclerViewAdapter.java where most of the work is required.
The challenges were as follows:
1) The ViewPager does not inflate properly inside the RecyclerView.
In order to solve this, the width of the ViewPager was manually set to the current width of the screen when it inflates inside the adapter. The height should be specified manaully and wrap_content attribute cannot be used.
2) The ViewPagers do not retain state as the list items are scrolled away from current view and back.
In order to solve this problem, the RecyclerViewAdapter holds a list of states for each of the ViewPager and sets them back when a previously modified item comes back in view.
…
No open issues yet, or sync has not completed.