0

I have a such TextInputLayout widget on my screen

<android.support.design.widget.TextInputLayout
        android:id="@+id/editTextClient"
        android:textColorHint="@color/colorPrimaryText"
        app:errorEnabled="true"
        app:hintEnabled="true"
        android:hint="@string/login"
        app:errorTextAppearance="@style/ErrorAppearence"
        app:hintTextAppearance="@style/TextLabel">

    <android.support.design.widget.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="text"
            android:singleLine="true"
            android:textColor="@color/colorPrimaryText"/>
</android.support.design.widget.TextInputLayout>

The style @style/ErrorAppearence defines error message. The style @style/TextLabel defines active label, when we'are printing something.

<style name="TextLabel" parent="TextAppearance.Design.Hint">
    <item name="android:textColor">@color/colorPrimaryText</item>
    <item name="android:textSize">12sp</item>
</style>

<style name="ErrorAppearence">
    <item name="android:textColor">@color/colorAccent</item>
    <item name="android:textSize">12sp</item>
</style>

Now I want to lower fontSize of EditText label, when it's not in active state. I need your help here, because I don't know what attribute I must tweak to achieve this. To define clearly what I'm meaning by "Label" I've attached picture below enter image description here

AlexF
  • 387
  • 1
  • 4
  • 20
  • This https://stackoverflow.com/questions/39107032/how-to-change-hint-text-size-without-changing-the-text-size-in-edittext/39107317 will help for u – PushpikaWan Oct 28 '18 at 15:12

1 Answers1

0

If you want to decrease font set it to 10sp but android-studio warning about this.

In your style.xml do this :

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

Then in TextInputLayout do this :

<android.support.design.widget.TextInputLayout
        android:id="@+id/editTextClient"
        android:textColorHint="@color/colorPrimaryText"
        app:errorEnabled="true"
        app:hintEnabled="true"
        android:hint="@string/login"
        app:errorTextAppearance="@style/ErrorAppearence"
        app:hintTextAppearance="@style/TextLabel">
Ali Khaki
  • 1,184
  • 1
  • 13
  • 24
  • Look at my post again. app:hintTextAppearance="@style/TextLabel" is already applied and it changes label when an input is on – AlexF Oct 28 '18 at 15:18