Last active
February 22, 2018 13:02
-
-
Save ameliacv/5b6717ade26a36cdf72ff5dc1d6cf553 to your computer and use it in GitHub Desktop.
Vertical Adapter Recycler View
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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