gpt4 book ai didi

Android TextView 网址

转载 作者:行者123 更新时间:2023-11-30 01:43:19 30 4
gpt4 key购买 nike

在 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/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com