Android:链接Android应用中的textview



我正在使用linkify,我想显示"google"而不是"http://www.google.com"当我运行应用程序plz任何帮助

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    TextView textView = (TextView) getActivity().findViewById(R.id.Link1);
    textView.setText("http://www.google.com/");
    Linkify.addLinks(textView,Linkify.ALL);

您可以使用Html.fromHtml(String source):

textView.setText(Html.fromHtml("<a href="http://www.google.com/">google</a>"));

最新更新