I have a ListView in which each item has a complex layout that contains, at some point, a TextView with android:inputType="text" and android:ellipsize="marquee". My problem is that inputType="text" does something that renders the whole listview item un-clickable. I’ve tried:
android:descendantFocusability="blocksDescendants"on the top-most layout of an item,android:focusable="false"on theTextViewitself,android:focusableInTouchMode="false"on theTextViewitself,android:clickable="false"on theTextViewitself,android:editable="false"on theTextViewitself.
Nothing worked.
The reason why I use android:inputType="text" on a TextView is so that it becomes single-line and android:ellipsize="marquee" actually works. I’ve done my homework:
android:singleLineis deprecated*android:lines="1", as suggested here, doesn’t work, the text still wraps, you just don’t get to see the second line, so the marquee effect does not appear.
* or is it? My Ctrl+Space in Eclipse says this about android:singleLine (emphasis mine):
Constrains the text to a single horizontally scrolling line instead of
letting it wrap onto multiple lines, and advances focus instead of
inserting a newline when you press the enter key. * 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 of singeLine is false (multi-
line mode), but if you specify any value for inputType, the default
is single-line mode. (If both singleLine and inputType attributes
are found, the inputType flags will override the value of
singleLine.). [boolean]
However, the docs do not say anything about any deprecation.
What’s going on here?
Actually in the official documentation of R.attr that attribute constant is deprecated.
However (as mentioned) this is contradicting the TextView documentation page. And when looking at the related methods, setting the singleLine attribute is equivalent to :
which too isn’t deprecated. And it is how i dance around that deprecation.