I have an edit text inside a textinputlayout. I am trying to set the mandatory field symbol (red color asterisk) to the edittext. I have set the hint to the edit text. My code is as below.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" * "
android:layout_gravity="center_vertical"
android:textColor="#ff0000"
android:textSize="15sp" />
<android.support.design.widget.TextInputLayout
android:id="@+id/tilEngNo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<EditText
android:id="@+id/engineno"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="15dp"
android:layout_marginRight="16dp"
android:hint="Engine No" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
This gives me the asterisk symbol outside the textinputlayout. So when I start typing in the edit text, the hint floats up, but not the asterisk symbol. My requirement is to make the asterisk symbol to behave as same as the hint of the edittext. What is the best approach?. Any help is appreciated. Thanks in advance