当URL链接点击安卓禁用onclick事件事件、链接、URL、onclick

2023-09-08 00:20:46 作者:帶刺的愛情

的TextView 包含网​​址喜欢的 www.google.com 的。此的TextView A还创建了一个onclicklistener。

I have textview which contains urls like www.google.com. for this textview a have also created a onclicklistener.

我的问题是,当用户clickes www.google.com,的链接用于由活动,但还创建活动 的onclick 事件。但我不希望创建的onclick 事件时的URL用户点击。

My problem is when user clickes www.google.com, link is used by an activity, but after that activity onclick event is also created. but i dont want to create onclick events when user clicks on urls .

是否有可能为texview禁用的onclick 活动时,像的的 http://www.google.com ,市场://安卓..等等的

Is it possible for texview to disable onclick events when user clickes on urls like http://www.google.com, market://android.. etc.

编辑1:我在下面的详细信息。

EDIT 1: I added details below.

            TextView entry = (TextView) v
                    .findViewById(R.id.textViewEntryText);
            entry.setText(Html.fromHtml(String.format("%s",
                    (CharSequence) displayText)));
            entry.setMovementMethod(LinkMovementMethod.getInstance());

的链接创建的TextView后,再放入另一个事件的onclick其他文本。

after creating textview with links then put another events onclick other texts.

            entry.setOnClickListener((new View.OnClickListener() {

                // TODO Auto-generated method stub

                public void onClick(View v) {
                    // TODO Auto-generated method stub

                    }
                }
            }));

现在,当用户点击URL链接,我不想其他onclick事件工作的链接。

Now when user clicks on url link i dont want to other onclick event works for links .

推荐答案

哇。 Android是魔术。有一个单独的属性为:

wow. Android is magic. There is a seperate attribute for that:

android:linksClickable:"false"

您可以改变它在code,通过:

You can change it in the code, via :

myTextView.setLinksClickable(false);