inputType下,使项目未点击 [英] inputType makes item un-clickable

查看:140
本文介绍了inputType下,使项目未点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个的ListView ,其中每个项目有一个复杂的布局,包含,在某些时候,一个的TextView 的android:inputType下=TEXT的android:ellipsize =金字招牌。我的问题是的inputType =TEXT做的的东西的呈现整个ListView项未点击。我试过:

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在最上面的布局的项目,

  • 机器人:可聚焦=FALSE的TextView 本身

  • 的android:focusableInTouchMode =FALSE的TextView 本身

  • 的android:点击=FALSE的TextView 本身

  • 机器人:编辑=假的TextView 本身

  • android:descendantFocusability="blocksDescendants" on the top-most layout of an item,
  • android:focusable="false" on the TextView itself,
  • android:focusableInTouchMode="false" on the TextView itself,
  • android:clickable="false" on the TextView itself,
  • android:editable="false" on the TextView itself.

毫无效果。

为什么我使用的原因的android:inputType下=上的TextView 是使之成为单一的文字直插式和的android:ellipsize =金字招牌实际工作。我做我的家庭作业:

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:SINGLELINE 是pcated德$ P $ *

  • 的android:行=1的建议<一href=\"http://stackoverflow.com/questions/3354589/using-inputtype-on-a-textview-in-a-list-item-layout\">here,不工作,文本还是包装,只是你不会看到第二行,所以​​字幕效果不会出现。

  • android:singleLine is 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.

*是吗?在Eclipse我的Ctrl +空格键说,这大约的android:SINGLELINE (重点煤矿):

* or is it? My Ctrl+Space in Eclipse says this about android:singleLine (emphasis mine):

约束的文本到单个水平滚动线代替
   让它换到多行,和垫款集中,而不是
   插入时你preSS回车键换行。 * 德precated
   此属性德precated并且由textMultiLine取代
   国旗在inputType下属性。改变时要小心
   现有的布局,为singeLine的默认值是假的(多
   行模式),但是如果你指定的inputType任何值,默认
   是单行模式。 (如果同时SINGLELINE和inputType下属性
   被发现时,inputType下标志将覆盖的值
   单线。)。 [布尔]

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]

不过,的文档不说什么任何德precation。

However, the docs do not say anything about any deprecation.

这是怎么回事?

推荐答案

其实在的该属性不变的的官方文档>是德precated。

Actually in the official documentation of R.attr that attribute constant is deprecated.

但是(如前所述),这是矛盾的 TextView的文档页面。而在看相关的方法,设置单行属性时,就相当于:

However (as mentioned) this is contradicting the TextView documentation page. And when looking at the related methods, setting the singleLine attribute is equivalent to :

myTextView.setTransformationMethod(new SingleLineTransformationMethod());

这也太不pcated德$ P $。它是我周围的德precation如何跳舞。

which too isn't deprecated. And it is how i dance around that deprecation.

这篇关于inputType下,使项目未点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆