Optimize listview performance Android

前端 未结 1 1739
被撕碎了的回忆
被撕碎了的回忆 2020-12-30 16:22

I have a listView (vertical) and every list item has a horizontal list view (horizontal).

But the problem is when i scroll the horizontal scrollview in the r

相关标签:
1条回答
  • 2020-12-30 16:41

    Dear i suggest to try My this Code

    public View getView(final int position, View convertView, ViewGroup parent) 
        {
             View v = convertView;
             ViewHolder holder;
    
             if (v == null) 
             {
                 v = inflater.inflate(R.layout.custom_image_layout, null);
                 holder = new ViewHolder();
                 holder.txtFileName = (TextView) v.findViewById(R.id.txtFileName);
                 holder.imageView = (ImageView) v.findViewById(R.id.imgView);
                 v.setTag(holder);
             } else 
             {
                 holder = (ViewHolder) v.getTag();
             }
    holder.imageView.setImageBitmap(bm);
    holder.txtFileName.setText(""+nameoffile);
    return v;
        }
        static class ViewHolder 
        {
             public ImageView imageView;
             public TextView txtFileName;
        }
    

    Use The Holder Class

    0 讨论(0)
提交回复
热议问题