[]
I have editText which scrolls horizontally. I want to decrease text size if text doesn't fit editText without scrolling. I tried use following condition:
var textSize = edtResult.textSize / resources.displayMetrics.scaledDensity
if (edtResult.width >= cardView.width && textSize > 22.0)
but edtResult.width returns width without scrolling
So my question:
You could try using the autosize TextView feature (only available for API >= 26 if using TextView
. For lower versions, use AppCompatTextView
).