ellipsize = end用省略号[duplicate]替换整个最后一行

问题描述 投票:1回答:1

这是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中(您可以从屏幕截图中猜出)。

这是它的样子:

Ellipsis is replacing the entire last line, instead of being at the end of it

这就是我希望它看起来的样子:

Ellipsis is at the end of the line, instead of at the beginning with nothing after it.

简而言之,我希望省略号位于最后一行的末尾,而不是替换最后一行。我怎样才能做到这一点?我更喜欢不需要任何Java的解决方案,但如果不可能,那我很好。

我在Android Studio 3.0.1上,用API 27查看它。我可以通过将<TextView>复制并粘贴到空白(除了<?xml>标题)文件中来重现此错误,屏幕大小足够窄文本包含在三行以上。

android android-studio textview ellipsis
1个回答
2
投票

似乎以下主题回答了您的问题:Setting Ellipsize on TextView reduces lines shown by one (instead of only ellipsizing last)一个答案表明它只是预览器的一个错误。

© www.soinside.com 2019 - 2024. All rights reserved.