D
D
Dmitry Richter2015-01-03 02:19:33
Java
Dmitry Richter, 2015-01-03 02:19:33

How to fix listView display issue?

I have a looped (infinite) listView, all positions in it are taken from files, and in general I have a problem with the appearance of an unnecessary "baby" (who did not quite understand everything is shown in the screenshot). I need to figure out why and where it appears? Because unfortunately I can't find it.
e39bd18fdf9d49b9b968133b2595801c.jpg
You can see the full code at the link or below part of the code:

private BaseAdapter mAdapter = new BaseAdapter() {
 
        @Override
        public int getCount() {
            return Integer.MAX_VALUE-1;//
           // return lines_image.size();
        }
 
        @Override
        public Object getItem(int position) {
 
            return null;
        }
 
        @Override
        public long getItemId(int position) {
            return 0;
        }
 
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View retval = LayoutInflater.from(parent.getContext()).inflate(R.layout.listview_leyout, parent, false);
            TextView title = (TextView) retval.findViewById(R.id.title);
            image_list_icon = (ImageView)retval.findViewById(R.id.image_fromlist);
           // title.setText(dataObjects[position%dataObjects.length]);
 
           title.setText(lines_image.get(position%lines_image.size()));
 
 
              if (title.getText() == lines_image.get(position% lines_image.size())) {
                  Picasso.with(retval.getContext()).load(url_first + lines_image.get(position% lines_image.size())).into(image_list_icon);
               }
 
 
 
                    ///// another, for video /////
                    if (position == mSelectedItem) {
                        retval.setBackgroundColor(Color.WHITE);
                        retval.getBackground().setAlpha(80);
                        retval.setMinimumHeight(retval.getHeight() + 15);
                        image_list_icon.getLayoutParams().height = image_list_icon.getLayoutParams().height + 30;
                        image_list_icon.getLayoutParams().width = image_list_icon.getLayoutParams().width + 30;
 
 
                        if (title.getText() == lines_image.get( position% lines_image.size())) {
                            String vidAddress = lines_video.get(position% lines_image.size());
                            Uri vidUri = Uri.parse(vidAddress);
                            vidView.setVideoURI(vidUri);
                             vidView.start();
                        }
//
 
                    } else if (position != mSelectedItem)
 
                    {
 
                        image_list_icon.getLayoutParams().height = image_list_icon.getLayoutParams().height - 5;
                        //image_list_icon.getLayoutParams().width=image_list_icon.getLayoutParams().width-5;
                    }
                    return retval;
                }
 
 
 
 
    };

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2015-01-08
@Xapaxuc

The problem is not in the adapter, but most likely in the fact that there is an extra element in the list, for which the Picasso library cannot load anything but shows the default value.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question