I want to apply custom style to TextInputLayout's
hint
and error
in one theme and apply it globally i.e. define it in styles.xml and somehow apply it to all TextInputLayouts
used throughout the app without having the need to add it inline like this:
<android.support.design.widget.TextInputLayout
android:id="@+id/usernameWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/email_username"
android:textColorHint="@color/grey_text"
app:theme="@style/my_custom_style">
<style name="my_custom_style" parent="Widget.Design.TextInputLayout">
<item name="android:textColorHint">@color/success_accent</item>
<item name="android:textSize">20sp</item>
</style>
Something like we can do the Button
widget like this:
styles.xml
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="buttonStyle">@style/my.Widget.Button</item>
<item name="android:buttonStyle">@style/my.Widget.Button</item>
</style>
<style name="my.Widget.Button" parent="@android:style/Widget.TextView">
<item name="android:gravity">center</item>
<item name="android:textSize">@dimen/some_dimen</item>
<item name="android:textAllCaps">false</item>
</style>
NOTE: I am currently considering subclassing the TextInputLayout
as a last resort, so, please keep this in mind while you answer.
Thanks :)