TextView 插入图片

来源:互联网 发布:美图秀秀软件怎样赚钱 编辑:程序博客网 时间:2024/06/09 19:20

    private void setFuJianPic(TextView textView) {
        Bitmap b = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.icon_fujian);
        ImageSpan imgSpan = new ImageSpan(getContext(), b);
        SpannableString spanString = new SpannableString("icon");
        spanString.setSpan(imgSpan, 0, 4, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
//        textView.setText(Html.fromHtml(content));
        textView.append(spanString);
    }

    private void setReadState(TextView textView) {
        Bitmap b = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.icon_group_topic_unread);
        ImageSpan imgSpan = new ImageSpan(getContext(), b);
        SpannableString spanString = new SpannableString("icon");
        spanString.setSpan(imgSpan, 0, 4, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        textView.append(spanString);
    }
0 0
原创粉丝点击