Search code examples
androidxmltextviewandroid-components

AutoSizeTextTypeUniform not working on samsung


I have a simple layout containing some views. This TextView has

        android:layout_width="match_parent"
        android:layout_height="wrap_content"

The autosizing is set programmatically like so..

  if (Utils.isOreoOrGreater()) {
                LinkTv.setAutoSizeTextTypeUniformWithConfiguration(1, 14, 1, TypedValue.COMPLEX_UNIT_DIP)
            }

My issue is on a Samsung Galaxy S9, it will not resize the text and keeps using an ellipsis. I've tried this in XML file and programmatically. Has anyone encountered this on a Samsung??

EDIT: Upon further inspection, the TextView is having its AutoSizeTextType changed from NONE to UNIFORM but the textsize is not being adjusted.


Solution

  • For anyone having issues with autoSizeTextType on single line text views. Make sure to set android:maxLines = 1 instead of android:singleLine = true, this solved the problem for me. However I'm not sure whats happening under the hood that causes this problem.