在低端设备中运行应用时,我遇到一个非常奇怪的问题,列表视图。
我的listview的数据源可以有大约350个元素。当我在普通手机中运行时,所有结果都会正确显示,但是当我在低端设备(例如处理器MT6572,512MB RAM)中运行时,它只显示3到5个结果(取决于屏幕大小)。
我调试了适配器,一切正常,因为所有方法都返回了预期的值,但我无法滚动表格。
我真的不知道会发生什么:没有抛出异常,没有错误返回...有什么可以尝试修复它的想法吗?
这是我的适配器的代码
public class ScolarshipsAdapter extends BaseAdapter {
private Context context;
private static LayoutInflater inflater;
public ScolarshipsAdapter(Context context) {
this.context = context;
inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
return MyApplication.getInstance().getBecas().size();
}
@Override
public Object getItem(int position) {
return MyApplication.getInstance().getBecas().get(position);
}
@Override
public long getItemId(int position) {
return Long.valueOf(MyApplication.getInstance().getBecas().get(position).getId());
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
Beca beca = MyApplication.getInstance().getBecas().get(position);
if (convertView == null) {
convertView = inflater.inflate(R.layout.adapter_common_scolarship_item, parent, false);
viewHolder = new ViewHolder();
viewHolder.lblDate = (TextView)convertView.findViewById(R.id.adapter_common_scolarship_item_date);
viewHolder.lblDescription = (TextView)convertView.findViewById(R.id.adapter_common_scolarship_item_descripcion);
convertView.setTag(viewHolder);
}
else {
viewHolder = (ViewHolder)convertView.getTag();
}
if(beca.getFecha_limite() != null)
viewHolder.lblDate.setText(beca.getFecha_limite());
else
viewHolder.lblDate.setText("Continua");
viewHolder.lblDescription.setText(beca.getTitulo());
return convertView;
}
private class ViewHolder {
TextView lblDate;
TextView lblDescription;
}
}
谢谢和问候