I want to display list item placeholder while content loading like: Faceook. How can I achieve that ?
There is now a new library called ShimmerRecyclerview
which is based from the Facebook Shimmer
To use it, you define your xml recyclerview like this:
<com.cooltechworks.views.shimmer.ShimmerRecyclerView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/shimmer_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:demo_child_count="10"
app:demo_grid_child_count="2"
app:demo_layout="@layout/layout_demo_grid"
app:demo_layout_manager_type="grid"
/>
demo_layout
attribute is where your template placeholder placed.
To show the shimmering layout, call:
shimmerRecycler.showShimmerAdapter();
And to hide it:
shimmerRecycler.hideShimmerAdapter();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With