EditText.setMovementMethod在ListView中LinkMovement方法 - 失去能力"按一下[列表中的行 [英] EditText.setMovementMethod with LinkMovement Method in ListView - loses ability to "Click" on rows in the list

查看:319
本文介绍了EditText.setMovementMethod在ListView中LinkMovement方法 - 失去能力"按一下[列表中的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,基本上我有一个包含与在从网络(简单化了HTML)的信息阅读和逐行显示它在一行上的能力的自定义适配器一个ListView自定义视图。

So, basically I have a custom View that contains a ListView with a custom Adapter that has the ability to read in information from the network (dumbed down HTML) and display it on a row by row basis.

这一切工作,但我需要读入被解析为它包含可以被窃听,并在浏览器中启动链接HTML文本。

All of this works, but I need the text that is read in to be parsed as HTML which contains links that can be tapped on and launched in browser.

我设法做到这一点:

text.setText(Html.fromHtml(textBuffer), TextView.BufferType.SPANNABLE);
text.setMovementMethod(LinkMovementMethod.getInstance());

伟大工程,任何< A HREF =>< / A> 文本链接显示为链接,并可以挖掘

Works great, any <a href=""></a> links in the text are displayed as links and can be tapped.

这是现在正在这么行的ListView中其余的不能被窃听(窃听或并举行)的副作用。基本上,所有的行现在是不可选

This is a side effect of now making it so the rest of the rows in the ListView cannot be tapped (or tapped and held). Basically, all the rows are non-selectable now.

有什么办法来实现两者的我需要什么?

Is there any way to achieve both of what I need?

谢谢!

推荐答案

当你把一个ListView的内部聚焦的一个项目,它会自动在ListView不可作为焦点。这是您所看到的行为。

When you put an item that is focusable inside a ListView, it automatically makes the ListView not focusable. This is the behavior you are seeing.

为了让他们两个聚焦的,我相信你可以调整<一href=\"http://developer.android.com/reference/android/view/ViewGroup.html#attr_android%3adescendantFocusability\"相对=nofollow> descendantFocusability ListView控件的属性。

To make them both focusable, I believe you can adjust the descendantFocusability property of the ListView.

请参阅这个问题了类似的问题。

这篇关于EditText.setMovementMethod在ListView中LinkMovement方法 - 失去能力&QUOT;按一下[列表中的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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