如何减慢微光效果的速度

Bri*_*hod 4 android

我已经尝试了微光的演示,FrameLayout但是它的速度非常快,我想放慢这种效果的速度。如何减慢shimmer效果速度以及如何使用该库的属性?

Nil*_*hod 5

您需要使用app:shimmer_duration="1500"来设置动画的速度ShimmerFrameLayout

尝试这个

<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>
Run Code Online (Sandbox Code Playgroud)


Bri*_*hod 5

默认情况下添加app:duration="1500"微光FrameLayout其持续时间为 1000,因此为了放慢速度,我增加了持续时间

 <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>
Run Code Online (Sandbox Code Playgroud)