code test

2020-02-12 16:38:39 浏览数 (1)

代码语言:javascript复制
// make links and image work
Handler handler = new Handler() {
    public void handleMessage(Message msg) {
        int what = msg.what;
        if (what == 200) {
            MessageSpan ms = (MessageSpan) msg.obj;
            Object[] spans = (Object[]) ms.getObj();
            for (Object span : spans) {
                if (span instanceof ImageSpan) {
                    Log.d(TAG, "点击了图片" ((ImageSpan) span).getSource());
                    //处理自己的逻辑
                }
            }
        }
    }
};
setMovementMethod(LinkMovementMethodExt.getInstance(handler, ImageSpan.class));

正常字

0 人点赞