在 android 中,可以单击带有 URL 的 TextView 以在网络中打开 URL,方法是:
android:autoLink="web"
我想做的是捕获这次点击,如果这个 TextView 包含一个 URL,那么我想显示一个对话框。我该怎么做?谢谢!
最佳答案
检查你的文本是否是url。
try {
new URI(YourText);
// show your dialog here
} catch (URISyntaxException e) {
// Certainly not an URL
}
关于Android TextView 网址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34125669/