Skip to content

Allow the text to grow to fit the space imposed by its parent #58

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Klox
Copy link

@Klox Klox commented Feb 8, 2022

If the view's dimensions grow, the text size did not grow because AutoFitTextView was using its existing dimensions as a maximum size. Now it retains the maximum dimensions set by its parent during the measure pass.

A sample activity is included to show the AutoFitTextView adjusting to the size constraints imposed by its parent. Without the above change, the text size would shrink but never grow.

While testing, I noticed that setting the text size to X would result in an actual text size of X-1 if there were no size constraints, so I fixed binarySearch.

@AndroidDeveloperLB
Copy link
Owner

I can't see the sample. Please show before&after the change (meaning 2 samples and 2 screenshots/videos), to make it clear what was fixed.

@Klox
Copy link
Author

Klox commented Feb 9, 2022

Why can't you see the sample? What have you tried?
If you run the sample activity with your existing library you will see the text size shrink and never grow. The library with my change will grow as the view's size increases.

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

Successfully merging this pull request may close these issues.

2 participants