//着色
String str = my_info.getTitle();//得到总共的数据title
//得到搜索关键字的开始索引
if(name != null){//要改变的字体
int indexOf = str.indexOf(name);//开始长度
if(indexOf != -1){
int end = indexOf+name.length();//结束长度
SpannableStringBuilder builder = new SpannableStringBuilder(str);
ForegroundColorSpan redSpan = new ForegroundColorSpan(Color.RED);
builder.setSpan(redSpan, indexOf, end, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
tv_title.setText(builder);
}
}
textview隐藏
textview.setVisibility(View.INVISIBLE);