在这里调用下面的方法:context.setText(Html.fromHtml(content, null, new MxgsaTagHandler(this)));//context是TextView的Id
public class MxgsaTagHandler implements TagHandler{
private int sIndex = 0;private int eIndex=0;
private final JsonHttpResponseHandler mContext;
public MxgsaTagHandler(JsonHttpResponseHandler jsonHttpResponseHandler){
mContext=jsonHttpResponseHandler;
}
public void handleTag(boolean opening, String tag, Editable output, XMLReader xmlReader) {
// TODO Auto-generated method stub
if (tag.toLowerCase().equals("mxgsa")) {
if (opening) {
sIndex=output.length();
}else {
eIndex=output.length();
output.setSpan(new MxgsaSpan(), sIndex, eIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}
}
private class MxgsaSpan extends ClickableSpan implements OnClickListener{
@Override
public void onClick(View widget) {
// TODO Auto-generated method stub
//具体代码,可以是跳转页面,可以是弹出对话框,下面是跳转页面
}
}
}