滚动时,Android Studio自定义ListView与图像滞后

问题描述 投票:0回答:2

我现在正在寻找2天来修复,但我找不到一个

你可以帮助我,这就是我现在所拥有的:我不是从服务器或其他东西下载图像

        @Override
    public View getView(int position, View view, ViewGroup viewGroup) {

        ViewHolder holder;

        if (view == null) {
            view = getLayoutInflater().inflate(R.layout.list_products, null);

            holder = new ViewHolder();

            holder.imageView = (ImageView) view.findViewById(R.id.imageView);
            holder.textView_name = (TextView) view.findViewById(R.id.textView_name);
            holder.textView_description = (TextView) view.findViewById(R.id.textView_description);

            view.setTag(holder);

        } else {
            holder = (ViewHolder) view.getTag();
        }


        holder.imageView.setImageResource(IMAGES[position]);
        holder.textView_name.setText(NAMES[position]);
        holder.textView_description.setText(DESCRIPTIONS[position]);

        return view;

    }
}

private static class ViewHolder {
    public ImageView imageView;
    public TextView textView_name;
    public TextView textView_description;
}

}

java android performance listview
2个回答
0
投票

您可以使用qazxsw poi库在android中加载图像。 qazxsw poi qazxsw poi


0
投票

如果特别处理图像或大内容,请尽量避免使用ListView。为此目的,Picasso被创建了。

还要确保您的应用程序主线程没有繁重的任务(磁盘,网络,大图像绘制等)。启用Picasso.with(context).load(R.drawable.landing_screen).into(imageView1);以获得重点。

© www.soinside.com 2019 - 2024. All rights reserved.