关于TextView图文混排自动换行解决方案

package com.qfdqc.views.pulltoloadmoreview;

import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.Html;
import android.widget.TextView;

import java.lang.reflect.Field;


public class FragmentMainActivity extends Activity  {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fragment_main);
        TextView t1 = (TextView) findViewById(R.id.txtOne);
        String s1 = ""+"我们都能杀四大会计师杰卡斯短时间按快点哈数据库的哈市看到客户萨科技的哈萨克
"
; t1.setText(Html.fromHtml(s1, new Html.ImageGetter() { @Override public Drawable getDrawable(String source) { Drawable draw = null; try { Field field = R.drawable.class.getField(source); int resourceId = Integer.parseInt(field.get(null).toString()); draw = getResources().getDrawable(resourceId); draw.setBounds(0, 0, draw.getIntrinsicWidth(), draw.getIntrinsicHeight()); } catch (Exception e) { e.printStackTrace(); } return draw; } }, null)); } }

你可能感兴趣的:(关于TextView图文混排自动换行解决方案)