在 Kotlin Android Studio 中设置提示 TextInputLayout 的字体

问题描述 投票:0回答:1
android kotlin android-studio hint textinputlayout
1个回答
0
投票

超级简单。

在您的

TextInputEditText
的 XML 中添加
android:fontFamily="font-family"

<com.google.android.material.textfield.TextInputLayout
        android:hint="شماره تلفن همراه"
        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
        android:layout_marginStart="5dp"
        android:layout_marginEnd="5dp"
        android:layout_marginTop="5dp"
        app:shapeAppearanceOverlay="@style/button4"
        app:boxStrokeColor="#4E4A4A"
        app:boxStrokeWidth="1dp"
        app:prefixText="+98"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.google.android.material.textfield.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="phone"
            android:id="@+id/phoneNumber"
            android:ems="10"
            android:fontFamily="YOUR FONT NAME HERE" <--- THIS
            android:textSize="13sp"
            android:textColor="@color/black"
            android:textStyle="normal"
            />
    </com.google.android.material.textfield.TextInputLayout>

如果这没有帮助,请告诉我,我将提供更多支持,祝您编码愉快!

© www.soinside.com 2019 - 2024. All rights reserved.