How to get other views in the same ViewHolder in the same position as the onClicked view (use in the RecyclerView adapter)

I have a RecyclerView in my application that displays a string containing photos and photos downloaded from the Internet. There is a photo and a button on the screen. When the user clicks the button, I want to make another top view on top of the photo on the screen.

I have a CustomViewHolder that contains all the views for a RecyclerView and a CustomRecyclerViewAdapter that displays the viewer's views. The onClick method for the button is overridden in CustomViewHolder, as shown below:

public static class CustomViewHolder extends RecyclerView.ViewHolder 
implements OnClickListener {

public Button mButton;
public ImageView mImageView1;
public ImageView mImageView2;

public CustomViewHolder(View v)
{
super(v);
mButton = (Button) ...           // Initializing views
mImageView1 = (ImageView) ...
mImageView2 = (ImageView) ...
}
@Override
    public void onClick(View v) {
        int id = v.getId();
        if(id == R.id.buttonid)
        {
             // TODO mImageView2.setVisibility(View.VISIBLE);
             // Any ideas on how to get the mImageView2 of this same item so it can be made visible?
        }
}

mImageView2 , . - , ? .

0
2

onBindViewHolder(ViewHolder holder, final int position) Adapter

.

LIKE

 @Override
public void onBindViewHolder(final ViewHolder holder, final int position) {

     holder.mImageView2.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

        }
    });
0

getAdapterPosition ViewHolder. Recycler/Adapter

0

All Articles