最近在写一个微博的应用,在使用Linkify的时候遇到了一些问题,加入我想将下面一段字符中的@用户名做成一个链接,代码是这样的,可是确没有达到目的,求大神指导:
String text = "回复@秋名:问题没有出在你这边吧,随机的。//@kiliy:那我怎么关注你呢?";
private static Pattern pattern = Pattern.compile("@.*\\s");//匹配@...
private static final String scheme = "test";//Url scheme string
public static void setTweetText(TextView textView, String text) {
textView.setText(text);
Linkify.addLinks(textView, pattern, scheme);
}
String text = "回复@秋名:问题没有出在你这边吧,随机的。//@kiliy:那我怎么关注你呢?";
private static Pattern pattern = Pattern.compile("@.*\\s");//匹配@...
private static final String scheme = "test";//Url scheme string
public static void setTweetText(TextView textView, String text) {
textView.setText(text);
Linkify.addLinks(textView, pattern, scheme);
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货