dependencies {
implementation 'com.facebook.shimmer:shimmer:0.4.0'
}
<com.facebook.shimmer.ShimmerFrameLayout
android:id="@+id/shimmer_view_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<!--我们希望起微光效果的视图-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="我的微信公众号:自学者" />
</com.facebook.shimmer.ShimmerFrameLayout>
ShimmerFrameLayout container = (ShimmerFrameLayout) findViewById(R.id.shimmer_view_container);
//开启微光动画
container.startShimmerAnimation();
setAutoStart():设置是否自动启动微光动画
setBaseAlpha:设置基视图的背景颜色
setDuration():从一个布局到另一个布局亮点需要时间。
setRepeatCount():设置当前动画重复的次数
setRepeatDelay():延迟多长时间重复当前动画
setRepeatMode():设置动画重复的模式
setMaskShape():设置当前高亮面具的形状
setAngle():设置当前高亮面具的角度
https://github.com/facebook/shimmer-android
本文地址:https://blog.csdn.net/weixin_44720673/article/details/107706704
如对本文有疑问, 点击进行留言回复!!
android开发实例(activity生命周期和启动模式、IPC机制)
realme真我V5 5G发布会在哪看 8月3号realme真我V5直播地址入口
Android Studio中gradle文件下载慢解决办法
Android 应用进程 ServiceManager 的实现
Shimmer-Android使用FrameLayout给视图添加微光效果
网友评论