I have created a form in the android app. It looks something like this. What I want is the text appearance in all the hints to be cosistent. If I use inputType = "textpassword" it gives the effect of confirm password which is different(bold) from other view. The field password has also same input type but the editext is not inside textInputlayout. The code for fields are as follows
<EditText
android:id="@+id/registerPasswordEt"
fontPath="fonts/Proxima_Nova_Light.ttf"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password *"
android:fontFamily="sans-serif"
android:textStyle="normal"
android:inputType="textPassword"
android:maxLines="1"
android:nextFocusDown="@+id/registerConfirmPasswordEt" />
2> Confirm password
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_confirm_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/input_layout_password">
<EditText
android:id="@+id/registerConfirmPasswordEt"
fontPath="fonts/Proxima_Nova_Light.ttf"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fontFamily="sans-serif"
android:hint="Confirm Password ( must match password ) *"
android:inputType="textPassword"
android:maxLines="1"
android:nextFocusDown="@+id/registerUserNameEt"
android:textStyle="normal" />
</android.support.design.widget.TextInputLayout>
3> Other field
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_last_name"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/registerLastNameEt"
fontPath="fonts/Proxima_Nova_Light.ttf"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Last Name *"
android:inputType="textPersonName"
android:maxLines="1"
android:nextFocusDown="@+id/registerPasswordEt" />
</android.support.design.widget.TextInputLayout>
What I want is all texts to look similar and I need TextInputLayout for animation effects. Is there a way to make the text appearance same?
The issue is because of the library calligraphy. Above issue occurs when you have calligraphy library and edittext with inputtype textpassword inside TextInputLayout. The solution I found are as follows.
Typeface confirmPasswordFace = Typeface.createFromAsset(getAssets(), CalligraphyConfig.get().getFontPath());
inputLayoutConfirmPassword.setTypeface(confirmPasswordFace); // or Typeface.NORMAL or any other
CalligraphyTypefaceSpan confrmPasswordTypefaceSpan = TypefaceUtils.getSpan(confirmPasswordFace);
SpannableString spannableConfirmPasswordHint = new SpannableString("Confirm Password ( must match password ) *");
spannableConfirmPasswordHint.setSpan(confrmPasswordTypefaceSpan, 0, spannableConfirmPasswordHint.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
inputLayoutConfirmPassword.setHint(spannableConfirmPasswordHint);