To include Shimmer in your project, add the following dependency:
// Gradle dependency on Shimmer for Android
dependencies {
implementation 'com.facebook.shimmer:shimmer:0.5.0'
}
========================================================
Usage in layout
--------------------------------------------------------------------------
<com.facebook.shimmer.ShimmerFrameLayout
android:id="@+id/shimmer_view_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:orientation="vertical"
app:shimmer_duration="800">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="@layout/data_placeholder_layout" />
<include layout="@layout/data_placeholder_layout" />
..................................
..................................
</LinearLayout>
</com.facebook.shimmer.ShimmerFrameLayout>
----------------------------------------------------------------------------
To start shimmer animation, use
shimmerLayout = findViewById(R.id.shimmer_layout)
shimmerLayout?.startShimmer()
----------------------------------------------------------
Check this also :-
Comments :
Post a Comment