간단하지만 작은 까다 롭습니다,어떻게 <Spanned>을 list.setAdapter에 넣을 까?
list.setAdapter(new ArrayAdapter<String>(this,R.layout.double_row, R.id.doubleRow, articleItemsHelper));
xItemsHelper xxxx articleItemsHelper
스팬이 (어댑터) doesn 일하지 마라.
ArrayList<Spanned> articleItemsHelper = new ArrayList<Spanned>();
솔루션은 무엇입니까?
private static class SpannedAdapter extends BaseAdapter {
private LayoutInflater mInflater;
private ArrayList<Spanned> mArticleList;
public SpannedAdapter(Context context, ArrayList<Spanned> articleList) {
mInflater = LayoutInflater.from(context);
mArticleList = articleList;
}
public int getCount() {
return mArticleList.size();
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.single_row, null);
holder = new ViewHolder();
holder.text = (TextView) convertView.findViewById(R.id.singleRow);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.text.setText(mArticleList.get(position));
return convertView;
}
static class ViewHolder {
TextView text;
}
}
list.setAdapter(new SpannedAdapter(this, articleItemsHelper));
여기서
articleItemsHelper
은
ArrayList<Spanned>
입니다.
아, TNX을. 나는 위의 게시물에 해결책을 게시했다. – svenkapudija
정말 좋은데, 임마! – Cristian