【发布时间】:2018-06-06 00:47:52
【问题描述】:
这是我的 TextView 的 XML 元素:
<TextView
android:id="@+id/todo_notes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="3"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
tools:text="This is a long description of what has to be done to make this task complete. It might only be one or two words (if the title is specific enough), or it might be a whole lot more than that." />
它包含在一个垂直的 LinearLayout 中(您可能可以从屏幕截图中猜到)。
看起来是这样的:
这就是我想要的样子:
简而言之,我希望省略号位于最后一行的末尾,而不是替换最后一行。我怎样才能做到这一点?我更喜欢不需要任何 Java 的解决方案,但如果这不可能,我可以接受。
我在 Android Studio 3.0.1 上,使用 API 27 查看它。我可以通过将 <TextView> 复制并粘贴到空白文件(<?xml> 标题除外)文件中来重现此错误,具有足够窄的屏幕尺寸,文本可以换行超过三行。
【问题讨论】:
标签: android android-studio textview ellipsis