Sreehari
Sreehari

Reputation: 5655

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

Upvotes: 0

Views: 2647

Answers (2)

Savin Sharma
Savin Sharma

Reputation: 799

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">

Upvotes: 2

Pushpendra
Pushpendra

Reputation: 2819

Add this to your styles:

<style name="InputTextLabel" parent="TextAppearance.Design.Hint">
    <item name="android:textSize">16sp</item>
</style>

And then TextInputLayout in your layout file should look like this:

 <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:hintTextAppearance="@style/InputTextLabel"
            android:minHeight="30dp">

Upvotes: 1

Related Questions