I have an EditText
inside a TextInputLayout
with +91
TextView
prefix to EditText
.
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin">
<android.support.design.widget.TextInputLayout
android:id="@+id/layoutMobile"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/etPhoneNumber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/txt_hint_phone"
android:imeOptions="actionDone"
android:inputType="phone"
android:maxLength="10"
android:maxLines="1"
android:minLines="1"
android:paddingLeft="30dp"
android:layout_marginBottom="10dp"
android:text="9736625345"
android:textColorHint="@color/colorBlack"
android:textSize="@dimen/sixteen_sp" />
</android.support.design.widget.TextInputLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerInParent="true"
android:text="+91"
android:textSize="16sp" />
</RelativeLayout>
But as android:paddingLeft="30dp"
is given to EditText
the hint and error message of TextInputLayout
also get shifted!!
I want hint and error message of TextInputLayout
to stay left align while EditText
should have a non-editable prefix.
What is the correct way of implementing this?