Is there a way to change the size of the caption that rises to the top of a TextInputLayout? I am not trying to change the size of the "hint" text that appears when the box is empty.
Of course, this can be done via creating a style for TextInputLayout. But more clear way to achieve this is doing it by creating TextAppearance styles.
Benifit of doing this is you can have separate styles for the hint label and error lable, where you can customize properties like color, size etc. (You can also have separate style for EditText inside TextInputLayout if needed as well.)
1.First create two styles like below:
<style name="TextInputStyle.Hint" parent="TextAppearance.AppCompat">
<item name="colorAccent">@color/colorPrimary</item>
<item name="android:textColor">@color/colorPrimary</item>
<item name="android:textSize">16sp</item>
</style>
<style name="TextInputStyle.Error" parent="TextAppearance.AppCompat">
<item name="colorAccent">#ed2d2d</item>
<item name="android:textColor">#ed2d2d</item>
<item name="android:textSize">12sp</item>
</style>
2.Then assign above styles in TextInputLayout like this:
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:errorEnabled="true"
app:errorTextAppearance="@style/TextInputStyle.Error"
app:hintTextAppearance="@style/TextInputStyle.Hint">
</android.support.design.widget.TextInputLayout>
Hope you will find it helpful :)