CharSequence接口的实现类有很多,平时我们常用的String,但是除了String,还有其他常用的类型
如:SpannableString
在Android 的 EditText中,如果我们不仅仅想放入文件,那么图片如何放入呢?
SpannableString ss = new SpannableString(resName );
//resName--->resId
int resId = MyApp.context.getResources().getIdentifier(resName, "drawable", MyApp.context.getPackageName());
if(resId!=0){
ss.setSpan(new ImageSpan(MyApp.context, resId), 0, resName.length(), SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
}
这样ss对象就不再是纯文本形式了