开发者

Using inputType on a TextView in a list item layout

I've made a ListActivity. I have an xml file that defines the layout for this Activity. I also have an xml file that defines the layout for an item in that list. This item layout has 3 TextViews inside of it. If I add the inputType="text" property to one of these TextViews, the onListItemClick handler no longer executes when I run my application in the emulator.

I noticed that singleLine="true" was deprecated, which is why I switched it out 开发者_如何转开发for inputType="text". Does anyone know why this is happening?

Note: I'm developing against 2.1

Thanks for your help


Setting an inputType probably causes the TextView to be focusable , and when you have a focusable element in a ListView row, the row is no longer clickable.

InputType has to do with users entering text. The equivalent to singleLine="true" would be lines="1", not inputType="text"


I had the same problem. I had resolved this issue by making textview's property focusable, false.

android:focusable="false"

Hope this would be useful to someone, as singleLine property is deprecated and inputType text is preferred.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜