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

TextView measurement error after rebinding ViewHolder. #56

Closed
TonicArtos opened this issue Mar 5, 2015 · 9 comments
Closed

TextView measurement error after rebinding ViewHolder. #56

TonicArtos opened this issue Mar 5, 2015 · 9 comments

Comments

@TonicArtos
Copy link
Owner

Sometimes view measurement doesn't update.

bugged measurement

               Fetched  D  position 82
                        D  82 was cached true
                        D  height 161
           measurement  D  params height -2
                        D  height 161

Correct measurement

               Fetched  D  position 82
                        D  82 was cached true
                        D  height 161
           measurement  D  params height -2
                        D  height 218

Maybe related to #55.


Further investigation reveals sometimes the views are just not being measured, though the call through recycler view is being made. There must be some residual state stopping measurement. What can stop measurement?

@TonicArtos
Copy link
Owner Author

Okay, so this is a problem caused by internal measurement logic in TextView. TextView will not measure itself again if it believes there has been no change to its content. As recycler view sets exact dimensions for the non scrolling axis, this crops up whenever a text view has been rebound and the width is to be changed. The workaround to force TextView to measure itself again by some method.

@TonicArtos
Copy link
Owner Author

One solution is to not use the match_parent value for layout_width for TextViews that are in a view group.

@TonicArtos
Copy link
Owner Author

Another is to use different viewTypeIds for views intended for different layouts.

@TonicArtos TonicArtos changed the title Caching error. TextView measurement error after rebinding ViewHolder. Mar 5, 2015
@TonicArtos
Copy link
Owner Author

So far I have been unable to work around the problem from the SuperSLiM end of things. :(

@TonicArtos
Copy link
Owner Author

Closing for now, people can resurrect this if they want to look into it again.

@PatrickDattilio
Copy link

Maybe leave this open so people can see/contribute, or make a note of it in the docs?

@TonicArtos
Copy link
Owner Author

I was going to note it in the docs, but sure, I'll leave it open too.

@TonicArtos TonicArtos reopened this Mar 5, 2015
@bejibx
Copy link

bejibx commented Apr 13, 2015

Maybe report this as an issue to AOSP issue tracker?

@TonicArtos
Copy link
Owner Author

I don't think it is a bug. I mean, TextView and RecyclerView are both doing the correct thing. For now, I don't plan on doing anything about this, but in the future I might see if there is something I can do; patching RecyclerView, or perhaps some kind of change to SuperSLiM.

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

No branches or pull requests

3 participants