Large ListView containing images in Android

前端 未结 7 1653
傲寒
傲寒 2020-12-15 13:50

For various Android applications, I need large ListViews, i.e. such views with 100-300 entries.

All entries must be loaded in bulk when the application

7条回答
  •  忘掉有多难
    2020-12-15 14:13

    A small piece of advice would be to disable loading of images when a fling occurs.


    dirty HACK to make everything faster:

    In your Adapter's getItemViewType(int position), return the position:

    @Override
    public long getItemViewType(int position) {
         return position;
    }
    @Override
    public long getViewTypeCount(int position) {
         return getCount();
    }
    @Override
    public View getView(int position, View convertView, ViewGroup arg2) {
        if (convertView == null) {
            //inflate your convertView and set everything
        }
        //do not do anything just return the convertView
        return convertView;
    }
    

    ListView will decide the amount of images to cache.


提交回复
热议问题