Как изменить размер подсказки TextInputLayout
Это мой xml
<android.support.design.widget.TextInputLayout
style="@style/main_input_text"
android:layout_marginTop="@dimen/activity_medium_margin"
app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout">
<android.support.v7.widget.AppCompatEditText
style="@style/main_edit_text"
android:inputType="text" />
</android.support.design.widget.TextInputLayout>
И это стиль
<style name="main_input_text">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">@dimen/activity_edittext_height</item>
<item name="android:background">@drawable/mc_shape_border_button_transparent</item>
<item name="android:gravity">center_vertical</item>
<item name="android:paddingTop">@dimen/activity_extra_small_margin</item>
<item name="android:paddingBottom">@dimen/activity_extra_small_margin</item>
<item name="android:keyTextSize">8sp</item>
<item name="android:textSize">8sp</item>
</style>
Я не нахожу что-то вроде hintSize, textSize и keyTextSize, не помогая
Ответы
Ответ 1
В ваших styles.xml
<style name="TextLabel" parent="TextAppearance.Design.Hint">
<item name="android:textSize">16sp</item>
</style>
И затем в вашем файле макета:
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginTop="12dp"
app:hintTextAppearance="@style/TextLabel"
android:minHeight="30dp">
Ответ 2
Измените TextInputLayout app:errorTextAppearance
в XML.
<android.support.design.widget.TextInputLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:errorTextAppearance="@style/CustomTextInputLayoutStyle.ErrorTextStyle">
Где CustomTextInputLayoutStyle.ErrorTextStyle
определяется в styles.xml
как
<style name="CustomTextInputLayoutStyle.ErrorTextStyle" parent="TextAppearance.Design.Error">
<item name="android:textSize">10sp</item>
</style>
Ответ 3
Вы можете уменьшить размер шрифта на EditText - это также уменьшит размер подсказки. т.е. андроид: textSize = "16sp"
Ответ 4
вы можете использовать атрибуты HTML для этого:
myView.setHint(Html.fromHtml("<small><small><small>" +
getString(R.string.hint) + "</small></small></small>"));
Здесь вы можете найти подробную информацию HTML-тегов: http://commonsware.com/blog/Android/2010/05/26/html-tags-supported-by-textview.html