【发布时间】:2020-01-09 07:06:18
【问题描述】:
如果EditText中文本的长度过长,在文本中添加空格时,空格后面的内容会被换行。例如,我有 60 个 1,没有空格或换行,假设每行可以包含 20 个 1,EditText 将显示如下
11111111111111111111
11111111111111111111
11111111111111111111
但是如果我在里面加空格,会是这样的
11111111111111111111
1
11111111111111111111
1111111111111111111
我在第二行的第一个 1 之后添加了空格,并且在该 1 之后的其他 1 被换行。我的预期是
11111111111111111111
1 111111111111111111
11111111111111111111
1
有什么办法吗?
编辑:
我正在尝试编写一个文本编辑器,所以我希望 EditText 是多行的。
我的代码是:
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="8dp"
android:layout_marginTop="4dp"
android:layout_marginRight="8dp"
android:inputType="textMultiLine"
android:gravity="start|top"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
【问题讨论】:
标签: android android-edittext android-xml word-wrap