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

Bug: very slow , truncates text and puts characters on next line #6

Open
AndroidDeveloperLB opened this issue Feb 9, 2016 · 0 comments

Comments

@AndroidDeveloperLB
Copy link

All I wanted is that it would fit into it boundaries.

Using the next XML will make it very slow and also truncate the text:

<com.omitneedlesscode.sizeadjustingtextview.SizeAdjustingTextView
    android:layout_width="180dp"
    android:layout_height="203dp"
    android:layout_below="@+id/text_input"
    android:maxLines="2"
    android:text="content text sample"
    android:textSize="1000dp"/>

And this is what I got :

device-2016-02-09-162003

plus it was very slow.

note that I've set 1000dp so that it will resize to the max that it can. a better way is to do it in code.

I think it should work this way:
using the current configurations of the TextView, if it failed to fit, try to find a font that will make it fit.
if failed with this, try to add a line (till reaching max lines that were set), and for each iteration there try to fit the font.

For the font checking, I think it should use binary search, instead of decreasing by 1 .

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

1 participant