Android recently added the support for resizing TextViews text size based on the view size and the min and max text size.
https://developer.android.com/guide/topics/ui/look-and-feel/autosizing-textview.html
Unfortunately, they don't support EditTexts, so Is there any other alternatives for EditText?
I was stuck as you, how EditText is child of TextView but don't support autosize ¿?¿?
I have achieve this with some kind of hack. First I saw the TextView code to copy and implement as extension (in Kotlin) on EditTextView, but.. there is a bulk of methods, so endly I discard that option.
What I have do, it's to use a TextView invisible (yes I know is a complete hack, am not very happy with that but Google should be ashamed about this)
This is my xmls
Note: It's important both view have the same width/height
Then on my code I use the autocalculations from this textview to use on my EditTextView.
As note, for change the size of hint i use this Android EditText Hint Size.
I know it's a hard workaround, but at least we are sure this will continue working even when resizable change on future versions, while a propetary or abandoned github lib will fail.
I hope some day, google hear us and implement on childs this wonderfull feature, and we could avoid all this stuff
Hope this helps
This library is based on:
AutoFitTextView https://github.com/ViksaaSkool/AutoFitEditText Please try this one