【发布时间】:2020-01-22 14:26:41
【问题描述】:
在 Android Studio 中使用带有 EditText 的自定义字体时,我似乎无法正确显示我的第一个字母
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<EditText
android:id="@+id/editText"
android:paddingLeft="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:fontFamily="@font/telly_humble"
android:textSize="35dp"
android:text="jay" />
</RelativeLayout>
编辑:忘了说我也试过 padding-left 或 start,对我都没有用。
我的最终解决方案是更改字体。
【问题讨论】:
-
去掉marginLeft后试试。
-
把 paddingleft 放进去检查一下。
-
我之前尝试过填充,这就是为什么我也尝试使用 marginLeft 而不是 paddingLeft 他们都没有很好的工作。
-
这不是最好的解决方案,但您可以简单地在文本前添加一个空格
-
能否也添加自定义字体 xml 文件?
标签: android android-layout android-edittext