【发布时间】:2020-12-05 16:48:36
【问题描述】:
我正在尝试在我的 android 移动应用程序中使用谷歌字体。我注意到当我使用自定义字体时,元素(EditText、Button)的中心对齐在底部有更大的空间。尝试了lineSpacingMultiplier 和lineSpacingExtra,但它不起作用。如果我改回默认的 Roboto 字体,它就可以正常工作。
<EditText
android:id="@+id/input_phone"
android:layout_width="300sp"
android:layout_height="60sp"
android:layout_marginTop="296dp"
android:autofillHints="@string/label_phone"
android:background="@drawable/custom_input"
android:hint="@string/label_phone"
android:inputType="phone"
android:maxLength="11"
android:textAlignment="center"
android:textSize="30sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="LabelFor" />
// custom_input
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:color="@color/colorSecondary"
android:width="2sp" />
<corners android:radius="10sp" />
<padding
android:bottom="10sp"
android:left="10sp"
android:right="10sp"
android:top="10sp" />
</shape>
我怀疑它与字体有关,但我需要使字体输入更大,所以我指定了它。
【问题讨论】:
标签: android android-studio androiddesignsupport