ZoomTextView icon indicating copy to clipboard operation
ZoomTextView copied to clipboard

Question: Can the same logic here work for auto-resizing TextViews ?

Open AndroidDeveloperLB opened this issue 10 years ago • 2 comments

I've searched in so many repositories and samples for a way to auto-resize the textView font size (and line count) to fit into its boundaries. All solutions don't work well: text gets truncated, part of a word goes to next line, ... Some solutions work, but only if the TextView has a single line of text that it can show.

My question: As this sample seems to work very well, is it possible to use a similar logic, and put it in a library that handles TextView's font and line count?

Here's a library I've made that has almost what I need: https://github.com/AndroidDeveloperLB/AutoFitTextView But as I wrote, all solutions I've found do not work well.

What I'd like to achieve is to start from a specified max font size, increasing line count up to the max that was set, and when reaching the max line count, reduce the font size (till the min font size allowed) so that the text will fit the boundaries of the TextView.

AndroidDeveloperLB avatar Feb 09 '16 13:02 AndroidDeveloperLB

I think yes, if we bind the font size with width and height of the TextView then this solution can work.

nomanr avatar Feb 09 '16 17:02 nomanr

Can you please show how to do it? All solutions I've found don't work well, and this is a very popular question on StackOverflow.

AndroidDeveloperLB avatar Feb 09 '16 20:02 AndroidDeveloperLB