当前位置:网站首页>Viewpager2 realizes Gallery effect. After notifydatasetchanged, pagetransformer displays abnormal interface deformation
Viewpager2 realizes Gallery effect. After notifydatasetchanged, pagetransformer displays abnormal interface deformation
2022-04-23 07:10:00 【Zhang Hailong_ China】

Gallery sliding effect is used in the project , Choose to use ViewPager2 Of CompositePageTransformer To achieve ,
val compositePageTransformer = CompositePageTransformer()
compositePageTransformer.addTransformer(MarginPageTransformer(dip2px(20f)))
compositePageTransformer.addTransformer { view, position ->
logger.d("addTransformer() position : " + position)
val r = 1 - Math.abs(position)
view.scaleY = 0.90f + r * 0.1f
}
There is no problem with the effect preview after writing , But the test found that when called frequently notifyDataSetChanged after , The gallery effect is deformed , When sliding left and right, the effect is restored
terms of settlement : When ViewPager2 Of Adapter call notifyDataSetChanged perhaps notifyItemChanged When ViewPager2 Call next :
setCurrentItem
Namely :
mViewPager.currentItem = mCurrentPosition
版权声明
本文为[Zhang Hailong_ China]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230607201269.html
边栏推荐
猜你喜欢

AVD Pixel_2_API_24 is already running.If that is not the case, delete the files at C:\Users\admi

Information:2021/9/29 10:01 - Build completed with 1 error and 0 warnings in 11s 30ms Error异常处理

./gradlew: Permission denied

Dolphinscheduler源码包src.tar.gz解压问题

Dolphinscheduler集成Flink任务踩坑记录

iTOP4412 LCD背光驱动(PWM)

this. getOptions is not a function

oracle undo使用率高问题处理

组件化学习(2)Arouter原理学习

iTOP4412 HDMI显示(4.0.3_r1)
随机推荐
oracle中生成32位uuid
Dolphinscheduler源码包src.tar.gz解压问题
Oracle RAC数据库实例启动异常问题分析IPC Send timeout
AVD Pixel_ 2_ API_ 24 is already running. If that is not the case, delete the files at C:\Users\admi
Itop4412 surfaceflinger (4.4.4_r1)
一款png生成webp,gif, apng,同时支持webp,gif, apng转化的工具iSparta
RAC环境报错ORA-00239: timeout waiting for control file enqueue排查
oracle生成毫秒级时间戳
[Exynos4412][iTOP4412][Android-K]添加产品选项
杂七杂八的学习
项目,怎么打包
oracle表的约束详解
Abnormal record-21
MySQL笔记1_数据库
useReducer基本用法
oracle存储过程中is和as区别
RAC环境中openssh版本对SSH互信创建的影响
B站用户视频观看记录的存储方案
通过rownum来进行区间查询
Exception record-14