1

Android アプリケーションを作成しました。about ボックスに、自分の Web ページのアドレスを入力しました。現在、このテキストは静的テキストとして表示されています。私の質問は、このテキストをクリック可能にすることは可能ですか? つまり、このようにクリックすると、Web ページがデフォルトのブラウザーで開くはずです。

4

3 に答える 3

1

これを試しましたか?

((TextView)findViewById(R.id.txtMessage)).setText(Html.fromHtml("your html"));
((TextView)findViewById(R.id.txtMessage)).setMovementMethod(LinkMovementMethod.getInstance());
于 2013-06-05T04:50:41.910 に答える
1

以下の行を使用します。

    final AlertDialog.Builder alert = new AlertDialog.Builder(this);
    final TextView input = new TextView(this);
    alert.setView(input);
    input.setText(Html.   
            fromHtml("www.google.com")); 
    Linkify.addLinks(input, Linkify.ALL); 
    alert.setMessage("Test");
    alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {



        }
    });

    alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            dialog.cancel();
        }
    });
    alert.show();    

これがお役に立てば幸いです。

于 2013-06-05T04:54:57.343 に答える