Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在小米手机无限 requestLayout(), 导致文字抖动、不断恢复初始位置等问题 [BUG] #271

Open
sunny-zhang-98 opened this issue Aug 4, 2021 · 10 comments

Comments

@sunny-zhang-98
Copy link

sunny-zhang-98 commented Aug 4, 2021

重新布局导致重新选择Page
重选Page导致Tab的onSelect执行
在OnSelect的时候设置了字体 Bold 导致了再次重新布局

暂时的解决方案:
mReselectWhenLayout = false

我不知道作者在这个字段注释中说的极端情况是什么情况

private boolean mReselectWhenLayout = true; // PositionData准备好时,是否重新选中当前页,为true可保证在极端情况下指示器状态正确

@sunny-zhang-98 sunny-zhang-98 changed the title 在小米手机无限 requestLayout(), 导致文字抖动、不断恢复初始位置等问题 在小米手机无限 requestLayout(), 导致文字抖动、不断恢复初始位置等问题 [BUG] Aug 5, 2021
@joymingchen
Copy link

极端情况可能是指视图出现错乱的情况,我遇见过这种情况,估计作者是为了确保视图正确
但我很好奇为啥只是小米手机会有这种情况,反复onlayout的情况

@hpdx
Copy link

hpdx commented Feb 15, 2022

我今天也遇到这个问题了,使用@Doinng提供的方案 commonNavigator.isReselectWhenLayout = false 暂时解决了问题 @joymingchen

小米手机是必现的,日志如下:
2022-02-15 15:39:49.908 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:49.923 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:49.931 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:49.938 4157-16760/? W/MiuiPerfServiceClient: interceptAndQueuing:30481|com.frogsing.timebureau|193|193|unknown|null|com.frogsing.timebureau/com.frogsing.mine.ui.homepage.CoachHomePageActivity|357629426099251|Slow handle traversal|1
2022-02-15 15:39:49.938 4157-16760/? I/com.miui.daemo: oneway function results will be dropped but finished with status OK and parcel size 4
2022-02-15 15:39:49.939 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:49.948 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:49.956 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:49.961 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:49.973 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:49.979 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:49.988 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:49.994 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:50.005 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:50.012 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:50.022 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:50.028 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:50.038 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:50.042 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:50.054 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:50.058 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:50.071 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:50.075 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:50.087 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:50.090 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:50.103 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:50.109 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:50.120 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:50.124 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:50.138 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:50.143 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:50.153 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:50.156 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:50.170 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:50.173 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:50.187 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:50.189 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:50.204 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:50.208 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:50.223 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:50.230 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:50.238 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:50.243 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:50.256 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:50.261 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:50.272 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:50.277 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:50.288 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:50.294 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:50.306 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:50.313 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame
2022-02-15 15:39:50.322 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ......ID 0,0-170,127} during layout: running second layout pass
2022-02-15 15:39:50.326 30481-30481/com.frogsing.timebureau W/View: requestLayout() improperly called by com.frogsing.common.utils.ScaleTransitionPagerTitleView{54eac3a VFED..C.. ........ 0,0-170,127} during second layout pass: posting in next frame

@WayneLyn
Copy link

@hackware1993 想问下这个mReselectWhenLayout = false这个办法是解决小米手机的方案么?还有其他方法优化么。。小米手机上不停抖动恢复位置也太奇怪了

@hackware1993
Copy link
Owner

你先试试 mReselectWhenLayout

@WayneLyn
Copy link

这样是可以的。但是我看您之前的注释说这个true是为了保证极端情况下选中正确的tab。想问下这个极端情况有多极端...大概都有啥场景会出现,想了解一下。我担心改为false的话会有新的问题

@hackware1993
Copy link
Owner

这个极端情况可能是早期 Android 版本的 bug。

@SelectSex
Copy link

image
image
这样应该能保证极端情况,且不会循环layout了,isReselectWhenLayout还是有点用的,但是无限调用太恐怖了,所以,我们在初始化adapter和调用notifyDataSetChanged的时候 将isReselectWhenLayout变成true,且layout只调用一次就改为false防止无限调用,
至于打印 requestLayout() improperly called by *****Fragment$initTabLayout$1$1$1$getTitleView$1{64008db VFED..C.. ......ID 241,0-440,115} during layout: running second layout pass
我们可以
image

@lhhailong
Copy link

不用那么麻烦 在这儿加个判断就好了

@lhhailong
Copy link

WechatIMG22

@Er3c
Copy link

Er3c commented Mar 26, 2024

今天也遇到这个问题了,应该是修改TextView的字体导致一直requestLayout,只要在onLayout中判断下是否是重复layout就行
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants