当前位置:网站首页>Coordinatorlayout appbarrayout recyclerview item exposure buried point misalignment analysis
Coordinatorlayout appbarrayout recyclerview item exposure buried point misalignment analysis
2022-07-03 04:52:00 【Baiyun City Lord Haoda】
Problem description
Coordinatorlayout ( Coordinator layout ) And AppBarLayout Realization topbar The effect of sliding zoom ,
RecyclerView Monitor when sliding stops The first and last visible item Report the exposure point
(findFirstVisibleItemPosition findLastVisibleItemPosition)
However, the reported buried point data is different from what users really see item Not in conformity with , The exposure buried point is inaccurate .
Question why
The height of the user's visible field of view (768)

RecyclerView Calculated height of 1104

Analysis of the source code AppBarLayout redefined heightMeasureSpec MeasureSpec scale size by 1653

The real boundary of the interface is at the bottom of the mobile screen

Solution
findLastVisibleItemPosition Value Start Decrement cycle to findFirstVisibleItemPosition , Judge again in turn item Whether it is the visual field area visible to the user
viewpager.getY()+item.getY() An area smaller than the screen height and considered visible to the user

Nuclear new code :

边栏推荐
- Day 51 - tree problem
- STM32 reverse entry
- [set theory] binary relationship (special relationship type | empty relationship | identity relationship | global relationship | divisive relationship | size relationship)
- 2022 Shandong Province safety officer C certificate examination content and Shandong Province safety officer C certificate examination questions and analysis
- Truncated sentences of leetcode simple questions
- [tools run SQL blind note]
- Shell script -- condition judgment
- 逆袭大学生的职业规划
- Concurrent operation memory interaction
- Market status and development prospect prediction of the global autonomous hybrid underwater glider industry in 2022
猜你喜欢

On typescript and grammar
![[USACO 2009 Dec S]Music Notes](/img/e6/282a8820becdd24d63dcff1b81fcaf.jpg)
[USACO 2009 Dec S]Music Notes

UiPath实战(08) - 选取器(Selector)

Sdl2 + OpenGL glsl practice (Continued)

Games101 Lesson 9 shading 3 Notes

Concurrent operation memory interaction

The reason why the entity class in the database is changed into hump naming

Introduction to message queuing (MQ)

2022 chemical automation control instrument examination summary and chemical automation control instrument certificate examination

移动端——uniapp开发记录(公共请求request封装)
随机推荐
[SQL injection point] location and judgment of the injection point
Sdl2 + OpenGL glsl practice (Continued)
After job hopping at the end of the year, I interviewed more than 30 companies in two weeks and finally landed
C language self-made Games: Sanzi (tic tac toe chess) intelligent chess supplement
Why does I start with =1? How does this code work?
Mount NFS in kubesphere
【XSS绕过-防护策略】理解防护策略,更好的绕过
@RequestMapping
[SQL injection] joint query (the simplest injection method)
Literature reading_ Research on the usefulness identification of tourism online comments based on semantic fusion of multimodal data (Chinese Literature)
雇佣收银员(差分约束)
2022 tea master (intermediate) examination questions and tea master (intermediate) examination skills
Thesis reading_ Chinese medical model_ eHealth
Distinguish between releases and snapshots in nexus private library
2022 new examination questions for the main principals of hazardous chemical business units and examination skills for the main principals of hazardous chemical business units
[PCL self study: filtering] introduction and use of various filters in PCL (continuously updated)
Concurrent operation memory interaction
Internationalization and localization, dark mode and dark mode in compose
Market status and development prospect prediction of global colorimetric cup cover industry in 2022
普通本科大学生活避坑指南