Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Place holder list item like facebook for content loading

I want to display list item placeholder while content loading like: Faceook. How can I achieve that ?enter image description here

like image 794
suresh Avatar asked Apr 26 '16 07:04

suresh


1 Answers

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();
like image 72
ajdeguzman Avatar answered Sep 21 '22 17:09

ajdeguzman