Q:

setTextSize doesn't work with AutofitTextView in Android

I'm using AutofitTextView and can't change text size on runtime.  My XML:
<me.grantland.widget. AutofitTextView
    android:id="@+id/header"
    android:text="Select Item"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:maxLines="1"
    android:textSize="85sp"
    autofit:minTextSize="16sp"
    autofit:sizeToFit="true"
    android:gravity="center"
    android:background="#fa0"
    android:textColor="@color/grey"
    />

My code:
 AutofitTextView header = (AutofitTextView) findViewById(R.id.header);
 header.setTextSize(TypedValue. COMPLEX_UNIT_SP, 25);

Code works when I changed XML tags to TextView but I need it to work with AutofitTextView also.  Any idea? 

A:

You can use like
For fix size [No Auto]
header.setMinTextSize(TypedValue. COMPLEX_UNIT_SP,25);
header.setMaxTextSize(TypedValue. COMPLEX_UNIT_SP,25);

For Auto [ Range will be between 16 to 25 ]
header.setMinTextSize(TypedValue. COMPLEX_UNIT_SP,16);
header.setMaxTextSize(TypedValue. COMPLEX_UNIT_SP,25);

