如何在警报对话框中为 Facebook 页面之类的网页创建 Link?

How can I make a Link to webpage like Facebook page in Alert Dialog?

我想在这样的警告对话框中添加我的(Facebook 页面)link:

public void visitFAcebook(){
    new AlertDialog.Builder(this)
            .setTitle("Find Us On Facebook")
            .setMessage("www.facebook.com/mypage")

            .show();

}

我可以将消息转换为可点击的 link 吗?

对您的代码进行以下更改。您可以如下更改颜色和字体。

public void visitFacebook(){
        String fbLink = "<a href=\"http://www.facebook.com/mypage\">My Facebook Page</a>";
        String Txt = "Click to visit facebook: "+"<h1>"+"<font color=blue>"+ fbLink+"</font></h1>";
        Spanned fbString = Html.fromHtml(Txt);


        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Title");
        builder.setMessage(fbString);
        builder.setCancelable(true);
        AlertDialog alertDialog = builder.create();
        alertDialog.show();
        TextView msgTxt = (TextView) alertDialog.findViewById(android.R.id.message);
        msgTxt.setMovementMethod(LinkMovementMethod.getInstance());
    }

Android 仅支持以下标签

<a href="...">
<b>
<big>
<blockquote>
<br>
<cite>
<dfn>
<div align="...">
<em>
<font size="..." color="..." face="...">
<h1>
<h2>
<h3>
<h4>
<h5>
<h6>
<i>
<img src="...">
<p>
<small>
<strike>
<strong>
<sub>
<sup>
<tt>
<u>