ViewPager图像视图在回收者视图中的随机项目位置显示null

时间:2018-11-01 10:42:36

标签: android listview android-viewpager

我有一个回收站视图,其中包含图库的视图寻呼机。我的列表视图显示所有数据,但图像的随机项目位置视图页面为空白

 @Override
public Object instantiateItem(@NonNull ViewGroup container, final int position) {
    LayoutInflater mLayoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    assert mLayoutInflater != null;
    View itemView = mLayoutInflater.inflate(R.layout.item_pager, container, false);

    ImageView imageView = itemView.findViewById(R.id.image_pager);
    final TextView more_photos_text = itemView.findViewById(R.id.more_photos_text);
    final RelativeLayout more_photos = itemView.findViewById(R.id.more_photos);
    more_photos.setTag(position);

    if (position == image.size( ) - 1) {
        if (screen == Command.ABS  && !isShowFullGallery) {
            more_photos.setVisibility(View.GONE);
        } else {
            more_photos.setVisibility(View.VISIBLE);
            more_photos_text.setText(Html.fromHtml("<u>For more photos</u>"));
        }
    }
    Log.e("image-----", galleryImages.get(position));
    Engine.getInstance(mContext).loadImage(mContext, galleryImages.get(position), imageView, Constant.PriorityOption.IMMEDIATE);
    container.addView(itemView,0);

    more_photos.setOnClickListener(v -> {
        callGallery(0);


    });

    imageView.setOnClickListener(v -> {
        callGallery(position);


    });

    return itemView;
}

0 个答案:

没有答案