TextView Check if ellipsized doesn't work with android:autoLink="web" -
usually how check if textviews have been ellipsized:
viewtreeobserver vto = description_detail.getviewtreeobserver(); vto.addongloballayoutlistener(new viewtreeobserver.ongloballayoutlistener() { @override public void ongloballayout() { layout l = description_detail.getlayout(); if (l != null) { int lines = l.getlinecount(); log.e("linecount=", string.valueof(lines)); log.e("getellipsiscount=", string.valueof(l.getellipsiscount(lines - 1))); if (lines > 0) if (l.getellipsiscount(lines - 1) > 0) //ellipsized } } });
as add
android:autolink="web"
to textview, doesn't work anymore.
i not understand why case. ideas?
edit:
<textview android:id="@+id/description_detail" android:layout_width="250dp" android:layout_height="wrap_content" android:layout_marginleft="15dp" android:ellipsize="end" android:autolink="web" android:maxlines="3" android:text="" android:textcolor="@color/hostgrey" android:textsize="16dp" />
so whenever lines count of textbox greater 3, it's being ellipsized.
debugging results:
with autolink active:
lines == 107 l.getellipsiscount(lines - 1) == 0
without autolink:
lines == 3 l.getellipsiscount(lines - 1) == 1
Comments
Post a Comment