Android SimpleCursorAdapter,具有文本视图和复合绘图功能
是否可以将Android SimpleCursorAdapter,具有文本视图和复合绘图功能,android,android-adapter,Android,Android Adapter,是否可以将文本视图+可绘制与SimpleCorsAdapter组合使用 我得到警告:这个标签和它的子标签可以被一个和一个复合可绘制标签替换,我不知道如何使用SimpleCursorAdapter修复这个问题 我以前的代码: convertView = mInflater.inflate(R.layout.list_item_group, null); ((TextView) convertView.findViewById(R.id.text)).setText(item.getName());
文本视图
+可绘制
与SimpleCorsAdapter
组合使用
我得到警告:这个标签和它的子标签可以被一个
和一个复合可绘制标签替换,我不知道如何使用SimpleCursorAdapter
修复这个问题
convertView = mInflater.inflate(R.layout.list_item_group, null);
((TextView) convertView.findViewById(R.id.text)).setText(item.getName());
((TextView) convertView.findViewById(R.id.text)).setCompoundDrawablesWithIntrinsicBounds(item.getIcon(), 0, 0, 0);
mAdapter = new SimpleCursorAdapter(getBaseContext(),
R.layout.list_item_group,
null,
new String[] { DataBaseHelper.KEY_NAME},
new int[] { R.id.name }, 0);
mListView.setAdapter(mAdapter);
谢谢如果您想在simplecursoradapter中使用可组合绘图,可以扩展simplecursoradapter并覆盖setViewText(TextView,String)我解决了这个问题,创建了实现ViewBinder的setViewValue方法,这是正确的解决方案吗?Tks