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

In the recyclerview, the expansion does not display the entire content correctly. #65

Open
qinxianyuzou opened this issue Dec 26, 2018 · 4 comments

Comments

@qinxianyuzou
Copy link

qinxianyuzou commented Dec 26, 2018

According to debug, I think that the number of rows that get the textview is incorrect. The number of rows obtained before the super.onMeasure() method is correct (may be 0), but the number of rows obtained after this is less. Up
------------------------------Above from Google Translate, the following is the original----------------------
根据debug,我认为是获取textview的行数不正确导致的,在super.onMeasure()方法之前获取到的行数是正确的(也可能是0),但是在这之后获取到的行数变少了

@qinxianyuzou
Copy link
Author

qinxianyuzou commented Dec 26, 2018

I see a problem, because mRelayout this switch affect the execution of onMeasure, this switch will only limit the re-measurement at the time the text changes, and in recyclerView in, setText time may not accurately measure the width and height, needs The measurement is accurate after the complete itemView is drawn, so just let the onMeasure perform the measurement smoothly after the view is drawn to solve the problem. My current solution is to remove the mRelayout condition. I don't know what it will do now,maybe it affects performance?
------------------------------Above from Google Translate, the following is the original----------------------
我发现了问题所在,是因为mRelayout这个开关影响了onMeasure的执行,这个开关限制了只有在文本变化的时候才会重新测量,而在recyclerView中,setText的时候可能并不能测量准确的宽高,需要在完整的itemView绘制之后测量才准确,因此只要让onMeasure在view绘制之后也能顺利往下执行测量就能解决问题。我目前的解决办法是把mRelayout这个条件去掉,目前不知道这样会有什么影响,也许是影响性能?

@eniz1806
Copy link

eniz1806 commented May 9, 2019

Yes, you are right. I have same problem. I see just half of my text when I do expand. Any solution out there for this? Thank you.

@qinxianyuzou
Copy link
Author

Yes, you are right. I have same problem. I see just half of my text when I do expand. Any solution out there for this? Thank you.

Please see my reply above.
if (!mRelayout || getVisibility() == View.GONE) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); return; }
to
if (getVisibility() == View.GONE) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); return; }

@taichushouwang
Copy link

Yes, you are right. I have same problem. I see just half of my text when I do expand. Any solution out there for this? Thank you.

Please see my reply above.
if (!mRelayout || getVisibility() == View.GONE) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); return; }
to
if (getVisibility() == View.GONE) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); return; }

In my case, remove mRelayout may cause shrink when click the textview first, so I also change the Animation reference #55

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

3 participants