0
我在我的註冊屏幕中使用TextInputEditText
。我能夠設置浮動標籤的風格。我想使用樣式在提示和文本TextInputEditText
上設置自定義字體。有誰知道最新的方式嗎?如何在styles.xml中設置TextInputEditText的樣式
<android.support.design.widget.TextInputLayout
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.support.design.widget.TextInputEditText
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" />
</android.support.design.widget.TextInputLayout>
styles.xml
<style name="AppTheme.InputLayoutStyle" parent="TextAppearance.AppCompat">
<item name="android:textColor">@color/colorPrimary</item>
<item name="fontFamily">@font/lato_light</item>
</style>
<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>
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
<item name="android:textViewStyle">@style/AppTheme.TextView</item>
<item name="buttonStyle">@style/AppTheme.Button</item>
</style>
我想設置樣式爲整個應用程序。
可能重複你可以TextInputLayout在XML中添加這種風格爲主題。 – Ankita
爲此我必須添加到每個TextInputLayout –
是的。在這種情況下,你必須這樣做 – Ankita