Search code examples
androidandroid-edittextandroid-textinputlayout

Increase TextInputLayout focused text size


I am trying to increase text size of hint in TextInputLayout while EditText is in focus. But not able to figure out how to do the same.

   <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/component_margin"
            >
              <EditText
                    android:id="@+id/firstName"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/prompt_first_name"
                    android:maxLines="1"
                    android:textSize="@dimen/normal_text"
                    android:maxLength="25"
                    android:theme="@style/EditTextTheme"
                     />
 </android.support.design.widget.TextInputLayout>

dimens.xml

<dimen name="normal_text">14sp</dimen>

styles.xml

 <style name="EditTextTheme">
        <item name="colorControlNormal">@color/colorPrimary</item>
        <item name="android:labelTextSize">@dimen/input_text_size</item>
 </style>

I want to increase size of Email shown in image for bigger screen devices.

enter image description here

Similarly for Password

enter image description here


Solution

  • You can use the default hintTextAppearance for TextInputLayout. Working fine for me

     <android.support.design.widget.TextInputLayout
            android:id="@+id/input_Email"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/ivLogoLogin"
            app:hintTextAppearance="@style/TextAppearance.AppCompat.Medium">