我想设置TextInputEditText
提示的自定义字体大小。我有一种风格,我想应用于我的所有TextInputEditText
。
它不适用于我的TextInputEditText
。任何人都可以帮助我,我错过了什么?
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="Widget.Design.TextInputLayout" parent="AppTheme">
<item name="hintTextAppearance">@style/AppTheme.TextFloatLabelAppearance</item>
</style>
<style name="AppTheme.TextFloatLabelAppearance" parent="TextAppearance.Design.Hint">
<item name="android:textSize">18sp</item>
</style>
</resources>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".login.AuthenticationActivity"
android:label="@string/login_screen_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<android.support.design.widget.TextInputLayout
android:id="@+id/access_code_input_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="@+id/guideline"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/guideline">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/login_participation_access_code"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
答案 0 :(得分:2)
您可以直接将app:hintTextAppearance
应用于TextInputLayout
:
<android.support.design.widget.TextInputLayout
...
app:hintTextAppearance="@style/AppTheme.TextFloatLabelAppearance"
...
>
或者在AndroidManifest.xml
中更改您的活动或应用程序主题:
android:theme="@style/Widget.Design.TextInputLayout"