How to display Superscripted hint in TextInputLayout in Android? I can't seem to figure it out.Here's my code

341 Views Asked by At

Here's my Activity.xml file. I put the AppCompatEditText inside TextInputLayout. I want the hint to be shown in the html form with superscript text but it just won't happen. All the text is shown as just normal text. Is there a way around?

    <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="8dp">

        <android.support.v7.widget.AppCompatEditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/acceleration_unit_ms2"
            android:inputType="numberDecimal"
            android:id="@+id/acceleration_unit_ms2"/>

    </android.support.design.widget.TextInputLayout>

Strings.xml

<string name="acceleration_unit_ms2">Meter/Second Square (m/s<sup><small>2</small></sup>)</string>
1

There are 1 best solutions below

1
On

According to efficient performance use TextInputEditText inside TextInputLayout.

<android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/input_layout_email"
        android:layout_marginTop="@dimen/dp_10"
        app:hintEnabled="true"
        app:hintAnimationEnabled="false">

        <android.support.design.widget.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/edit_email"
            android:inputType="textEmailAddress"
            android:hint="@string/email"
            android:textSize="16sp"/>

</android.support.design.widget.TextInputLayout>