[英]How to slow down the speed of shimmer effect
我已经尝试过微光FrameLayout
的演示,但它进行得非常快,我想减慢这种效果的速度。 如何减慢shimmer
效果的速度以及如何使用该库的属性?
您需要使用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>
将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>
尝试在 XML 中定义app:shimmer_duration
。
例如app:shimmer_duration="1000"
XML Attr:
app:shimmer_duration=""
您可以以编程方式执行以下操作 -
val builder = Shimmer.AlphaHighlightBuilder()
builder.setDuration(500L)
shimmerFrame.setShimmer(builder.build())
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.