ShowcaseView
ShowcaseView copied to clipboard
Describe the different parts/elements of an item of recyclerview
Hello! Congratulations!
I wanted to ask if you can use within an adapter to describe the different parts/elements of an item of recyclerview?
Thank you very much!
Hello victortu I had the same intention. I solved it like this: in the method "onBindViewHolder" you have the viewHolder.itemView object which you can use to get the context and therefore use the "findViewById" method. My code looks as follows:
public void onBindViewHolder(ViewHolder viewHolder, int position) {
...
FragmentActivity activity = (FragmentActivity) viewHolder.itemView.getContext();
ViewTarget target = new ViewTarget(viewHolder.itemView.findViewById(R.id.yourItem));
.new ShowcaseView.Builder(activity)
.withNewStyleShowcase()
.setStyle(R.style.yourOwnStyle)
.setTarget(target)
.setContentTitle("Title")
.setContentText("ContentText")
.hideOnTouchOutside()
.build();
}