问题描述
- Android 中ListView 的 Alphabet Indexer滞后问题
- 在程序中使用CustomCursorAdapter来创建section headers。我从ListView 行中移除所有的图像,但是滚动还是相当的滞后。有谁知道用什么方法来优化吗?
public View getView(int position View convertView ViewGroup parent) { final int type = getItemViewType(position); if (type == TYPE_HEADER) { if (convertView == null) { final LayoutInflater inflater = LayoutInflater.from(context); convertView = inflater.inflate(R.layout.list_header parent false); } ((TextView) convertView.findViewById(R.id.list_header_title)) .setText((String) getSections()[getSectionForPosition(position)]); return convertView; } else { View v = super.getView( position - sectionToOffset .get(getSectionForPosition(position)) - 1 convertView parent); int contactIdCol = c.getColumnIndex(ContactsContract.CommonDataKinds.Phone.CONTACT_ID); String contactId_text = c.getString(contactIdCol); boolean flag = db.isRegistered(contactId_text); ImageView iv = (ImageView) v.findViewById(R.id.typeImage); if (flag) { iv.setImageResource(R.drawable.rocket); } else { iv.setMinimumHeight(Config.getIconSize(context)); iv.setMinimumWidth(Config.getIconSize(context)); iv.setImageDrawable(null); } ImageView iv1 = (ImageView) v.findViewById(R.id.test); cl.displayImage(contactId_text iv1); return v; }}
时间: 2024-09-01 11:09:20