Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to slow down the speed of shimmer effect

Tags:

android

I have tried the demo of shimmer FrameLayout but it goes very fast and I want to slow down the speed of this effect. How to slow down the speed of shimmer effect and how to use the properties of this library?

like image 665
Brinda Rathod Avatar asked Mar 21 '18 06:03

Brinda Rathod


People also ask

What is a shimmering effect?

About. Shimmer is an Android library that provides an easy way to add a shimmer effect to any view in your Android app. It is useful as an unobtrusive loading indicator that was originally developed for Facebook Home.


2 Answers

You need to use app:shimmer_duration="1500" to set speed of animation in ShimmerFrameLayout

Try this

<com.facebook.shimmer.ShimmerFrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    app:shimmer_duration="1500">

    <View
        android:layout_width="100dp"
        android:layout_height="8dp"
        android:background="#dddddd" />

</com.facebook.shimmer.ShimmerFrameLayout>
like image 164
AskNilesh Avatar answered Sep 28 '22 14:09

AskNilesh


Add app:duration="1500" to shimmer FrameLayout by default its duration is 1000 so to slow down i increase the duration

 <com.facebook.shimmer.ShimmerFrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorAccent"
    app:duration="1500"
    android:id="@+id/shimmer">

  <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textColor="#fff"
      android:layout_gravity="center"
      android:textSize="30dp"
      android:text="Shimmer Effect"/>

</com.facebook.shimmer.ShimmerFrameLayout>
like image 32
Brinda Rathod Avatar answered Sep 28 '22 15:09

Brinda Rathod