I was trying google fonts to use in my android mobile application. I've noticed that when I used custom font, the center alignment to element (EditText, Button) has bigger space at the bottom. Tried lineSpacingMultiplier
and lineSpacingExtra
but it doesn't work. If I turned back to default Roboto font it works just fine.
<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>
I suspect that it has something to do with the font but I need to make the font input bigger so I specified it.