我在注册屏幕上使用TextInputEditText.我可以设置浮动标签的样式.我想使用样式在TextInputEditText的提示和文本上设置自定义字体.有谁知道这是怎么回事?
android:id="@+id/til_registration_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:paddingEnd="@dimen/default_view_padding_right_8dp"
android:paddingStart="@dimen/default_view_padding_left_8dp"
android:textColorHint="@color/colorSecondaryText"
app:hintTextAppearance="@style/AppTheme.InputLayoutStyle"
app:layout_constraintTop_toBottomOf="@id/textview_registration_title">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/registration_name"
android:imeOptions="actionNext"
android:singleLine="true"
android:textColor="@color/colorPrimaryText" />
styles.xml
@color/colorPrimary
@font/lato_light
@color/colorPrimary
@color/colorPrimaryDark
@color/colorAccent
@style/DrawerArrowStyle
@style/AppTheme.TextView
@style/AppTheme.Button
我想为整个应用程序设置样式.
解决方法:
旧问题,但值得回答.
只需在应用程序主题中设置“ textInputStyle”以设置TextInputLayouts的样式,并设置“ editTextStyle”以设置TextInputEditTexts的样式.
@color/colorPrimary
@color/colorPrimaryDark
@color/colorAccent
@style/DrawerArrowStyle
@style/AppTheme.TextView
@style/AppTheme.Button
@style/MyCustomTextInputStyle
@style/MyCustomEditTextStyle
@color/colorSecondaryText
@style/any_style_you_may_want"
@color/colorPrimary
@font/lato_light
这会将相同的样式应用于应用程序中的所有TextInputLayout和TextInputEditText.
标签:android
来源: https://codeday.me/bug/20191025/1930169.html