Skip to content

Instantly share code, notes, and snippets.

@ameliacv
Last active February 22, 2018 13:02
Show Gist options
  • Save ameliacv/5b6717ade26a36cdf72ff5dc1d6cf553 to your computer and use it in GitHub Desktop.
Save ameliacv/5b6717ade26a36cdf72ff5dc1d6cf553 to your computer and use it in GitHub Desktop.
Vertical Adapter Recycler View
public VerticalAdapter(List<Object> items, Context context) {
mValues = items;
mContext = context;
}
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
//Don't forget to clear
holder.mListPhoto.clear();
holder.mListImage.setVisibility(View.VISIBLE);
holder.mListPhoto.addAll(YOUS LIST DATA);
}
public class ViewHolder extends RecyclerView.ViewHolder {
public final View mView;
private List<Object> mListPhoto;
@BindView(R.id.imageList)
RecyclerView mListImage;
public ViewHolder(View view) {
super(view);
ButterKnife.bind(this, view);
mView = view;
mListPhoto = new ArrayList<>();
mListImage.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
HorizontalAdapter horizontalImageAdapter = new HorizontalAdapter(mListPhoto);
mListImage.setAdapter(horizontalImageAdapter);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment