ShowcaseView icon indicating copy to clipboard operation
ShowcaseView copied to clipboard

Describe the different parts/elements of an item of recyclerview

Open victortu opened this issue 9 years ago • 1 comments

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!

victortu avatar Jul 23 '16 10:07 victortu

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();
}

marshalluous avatar Jul 05 '17 06:07 marshalluous