0

下面是警报对话框的代码。我在谷歌地图中使用它。我想在消息末尾添加“查看更多”超链接。我不知道到目前为止我错过了什么以使链接正常工作。提前感谢您的帮助。

@Override
    protected boolean onTap(int index) {
        // TODO Auto-generated method stub
        OverlayItem item = pinpoints.get(index);
        AlertDialog.Builder dialog = new AlertDialog.Builder(c);
        dialog.setTitle(item.getTitle());
        dialog.setMessage(item.getSnippet()+"\n\n"+Html.fromHtml("<a href=\'http://www.nip.org.np\'>See more</a>"));
        dialog.show();
        return true;

    }
4

1 回答 1

0
@Override
protected boolean onTap(int index) {
    // TODO Auto-generated method stub
    OverlayItem item = pinpoints.get(index);
    AlertDialog.Builder dialog = new AlertDialog.Builder(c);
    dialog.setTitle(item.getTitle());
    dialog.setMessage(item.getSnippet()+"\n\n"+Html.fromHtml("<a href=\'http://www.nip.org.np\'>See more</a>"));
    dialog.show();

    try {
        TextView tv = (TextView) dialog.getWindow().findViewById(android.R.id.message);
        if (tv != null) tv.setMovementMethod(LinkMovementMethod.getInstance());
    } catch (Exception e) {}

    return true;

}
于 2012-12-21T09:45:38.097 回答