【发布时间】:2017-06-05 06:30:12
【问题描述】:
-
我的 TextView 标签看起来像这样
<TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:drawableEnd="@drawable/search_pickup_address" android:drawablePadding="@dimen/space" android:scrollHorizontally="false" android:ellipsize="end" android:inputType="text" android:maxLines="1" android:minLines="1" /> -
我已经设置了所有这些属性
android:scrollHorizontally="false" android:ellipsize="end" android:maxLines="1" android:minLines="1" -
由于不推荐使用单行 true 方法
android:singleLine="true" -
当我使用此方法时,点显示正常。
String label; if (string.length() >= 35) { label= data.substring(0, 35)+ "..."; } else { label= data; } textView.setText(label); -
但是有没有像
这样的直接方法android:singleLine="true"
【问题讨论】:
-
你有没有想过淡化 TextView 的末端而不是 ellipsize 的可能性?
-
您只是在问如何修复椭圆大小吗?还是你真的想要另一种方法来做到这一点?
-
我只是要求其他方法.. 就像这只能在 XML 中实现。
-
如果你的意思是,可以严格在布局 XML 中完成,那么可以。从
<TextView>元素中删除inputType属性。
标签: android xml android-layout textview android-design-library