java - 当 RecyclerView 滚动到特定点时(从底部开始并在屏幕中间完成其进度)时为 ProgreessBar 设置动画
问题描述
我在嵌套的 recyclerView 中有一个水平进度条。情况是我想在行列式进度条在底部上方 5 dp 时开始动画,并在到达屏幕中间时完成进度。想象一下你有一段时间滚动 recyclerView。一旦它在滚动 recyclerVeiw 时从底部出现,它就会开始增加进度,并在到达屏幕中间时完成进度。我附上了圆形进度条的演示视频,应该如何完成。任何建议将不胜感激。样品链接
我也试过这个和其他一些样品
int[] location = new int[2];
holder.progressbar_text.getLocationOnScreen(location);
int menuViewX = location[0];
int menuViewY = location[1];
我试图计算进度条的位置。如您所见,我正在垂直获取进度条的位置,即 menuViewY。这是我尝试过的解决方案link1。link2 在上述两个问题中,我尝试了所有建议的解决方案。
Log.i("bound", "Absolute Position" + menuViewY);
// Progresbar animations
holder.progressbar_text.enableAnimation();
holder.progressbar_text.setScrollBarFadeDuration(9000);
holder.progressbar_text.setAnimationSpeedScale(5);
holder.progressbar_text.setProgress(40);
holder.progressbar_text.setSecondaryProgress(70);
解决方案
推荐阅读
- jquery - 如何删除具有计数器的类名
- spring-integration - 使用 Spring Integration Flow 的多个过滤器表达式
- python - 转换 s3 视频文件分辨率并将其存储回 s3
- python - Azure 数据工厂管道:使用 Python 创建管道:身份验证(通过 az cli)
- powershell - 循环将 c:\, d:\ ... z:\ 替换为 \\servername\c$\
- mongodb - MongoDB:查找其子文档包含给定值的文档
- react-native - 用 MaterialCommunityIcons 中的图标替换 react-native-paper 搜索栏中的搜索图标
- c++ - WinAPI。检查窗口大小调整是否已完成
- widget - 错字3分页小部件不以 uid 1 开头,以最后一个 uid 之后的下一个 uid 开头
- php - 在父方法中获取子类名