简体   繁体   English

Android 弹出超链接

[英]Android Hyperlinks in Pop up

I want a popup box to come up and I want the text in the box to hyperlink any valid links in the box.我想要一个弹出框出现,我希望框中的文本超链接框中的任何有效链接。 In my example, it is a email address.在我的示例中,它是一个 email 地址。 I am using an AlertDialog currently, is there someway to make the link clickable, or should I try something else?我目前正在使用 AlertDialog,是否有办法使链接可点击,或者我应该尝试其他方法吗?

i'm not seeing you code.我没有看到你的代码。 is it a custom dialog??是自定义对话框吗?? you can place button in AlerDialog您可以在 AlerDialog 中放置按钮

AlertDialog alertDialog = new AlertDialog.Builder(a).create();
    alertDialog.setTitle(title);
    alertDialog.setMessage(message);
    alertDialog.setButton2("OK", new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dialog, int which) {
          //place what you want to do here 
              return ;
    } });
alertDialog.show();

Depending on the complexity of what you want to do, you might consider Creating a Custom Dialog with a TextView in it.根据您想要执行的操作的复杂性,您可能会考虑创建一个包含TextView的自定义对话框。 You could then use the android:autoLink attribute on the TextView in the layout xml.然后,您可以在布局 xml 中的TextView上使用android:autoLink属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM