增加 TextInputLayout 聚焦的文本大小
Increase TextInputLayout focused text size
我正在尝试在 TextInputLayout
中增加提示的文本大小,同时 EditText
处于焦点状态。但无法弄清楚如何做同样的事情。
<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.
Similarly for Password
将此添加到您的样式中:
<style name="InputTextLabel" parent="TextAppearance.Design.Hint">
<item name="android:textSize">16sp</item>
</style>
然后布局文件中的 TextInputLayout 应如下所示:
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hintTextAppearance="@style/InputTextLabel"
android:minHeight="30dp">
您可以为 TextInputLayout 使用默认的 hintTextAppearance。对我来说工作正常
<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">
我正在尝试在 TextInputLayout
中增加提示的文本大小,同时 EditText
处于焦点状态。但无法弄清楚如何做同样的事情。
<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.
Similarly for Password
将此添加到您的样式中:
<style name="InputTextLabel" parent="TextAppearance.Design.Hint">
<item name="android:textSize">16sp</item>
</style>
然后布局文件中的 TextInputLayout 应如下所示:
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hintTextAppearance="@style/InputTextLabel"
android:minHeight="30dp">
您可以为 TextInputLayout 使用默认的 hintTextAppearance。对我来说工作正常
<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">