当我从代码中删除滑行时,它可以完美滚动。
这是我的main_activity代码
if(finalI == size-1) {
Collections.reverse(posts_list);
ImageListAdapter adapter = new ImageListAdapter(posts_list);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView_in_profile.setLayoutManager(linearLayoutManager);
recyclerView_in_profile.setNestedScrollingEnabled(false);
recyclerView_in_profile.setAdapter(adapter);
}
这是我的适配器代码,用于将图像加载到回收站视图的每个项目中。
public class ImageListAdapter_forAdd extends ArrayAdapter<String> {
private Activity context;
private int resource;
private List<String> listImage;
ImageListAdapter_forAdd(@NonNull Activity context, @LayoutRes int resource, @NonNull List<String> objects) {
super(context, resource, objects);
this.context = context;
this.resource = resource;
listImage = objects;
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
LayoutInflater inflater = context.getLayoutInflater();
@SuppressLint("ViewHolder") View v = inflater.inflate(resource, null);
// TextView tvName = (TextView) v.findViewById(tvImageName);
v.layout(0,0,0,0);
ImageView img = (ImageView) v.findViewById(R.id.imgView);
// tvName.setText(listImage.get(position).getName());5555
Glide.with(context).load(listImage.get(position)).into(img);
return v;
}
}
在另一个片段中,我只对回收站视图使用了相同的代码,它的工作正常,但是在嵌套滚动中,似乎滑行可能存在一些问题。
谢谢。