当前位置: 代码迷 >> Android >> Android——字符高亮展示(转载)
  详细解决方案

Android——字符高亮展示(转载)

热度:89   发布时间:2016-05-01 15:59:26.0
Android——字符高亮显示(转载)
String str="adsjoiasdjpaisdjpaidj";    /** Called when the activity is first created. */    @Override    public void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.main);        TextView textview=(TextView)findViewById(R.id.textView);        SpannableStringBuilder style=new SpannableStringBuilder(str);        style.setSpan(new ForegroundColorSpan(Color.RED),3,8,Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);        textview.setText(style);    }

?

?

  相关解决方案