12

Is it possible to have a single line TextView that cuts off at the nearest pixel and does not add three dots?

Seraphim's
  • 12,559
  • 20
  • 88
  • 129
700 Software
  • 85,281
  • 83
  • 234
  • 341

2 Answers2

27
<TextView
    android:id="@+id/text_ivew"
    style="@style/Text.Title"
    singleLine="false"
    android:ellipsize="end"
    android:lines="1"
    android:text="text"></TextView>
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
gio
  • 279
  • 2
  • 2
  • 2
    according to Eclipse's documentation singleLine is "* Deprecated: This attribute is deprecated and is replaced by the textMultiLine flag in the inputType attribute. Use caution when altering existing layouts, as the default value...." i used it without and works fine on android 2.1 :) – max4ever May 31 '11 at 14:27
  • `inputType` on `TextView`? Isn't that or EditText? – Sourabh Mar 31 '15 at 13:47
  • Didn't work with me, text still shows ellipsis (left cell pushes right cell to the right so text in right cell shows ellipses). – Jose Manuel Abarca Rodríguez Apr 27 '15 at 18:44
  • setting android:ellipsize="none" in XML is enough. – Kai Wang Mar 17 '16 at 18:18
5

You should just be able to set the android:ellipsize property to false on your TextView in xml.

bran.strat
  • 51
  • 2