标题说明了一切,这是我的onBindViewHolder
:
public void onBindViewHolder(final AreaAdaptor.MyViewHolder holder, final int position)
{
final AreaAlbum album = albumList.get(position);
Glide.with(mContext).load(album.getThumbnail()).into(holder.thumbnail);
holder.title.setText(album.getName());
holder.thumbnail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (toolbar.getTitle().toString().equals("Maharashtra")) {
if (position == 1) {
Intent intent = new Intent(view.getContext(), MaharashtraDetail.class);
intent.putExtra("AreaName", position);**strong text**
*mContext.startActivity*(intent);
}
...
}
...
}
...
}
答案 0 :(得分:0)
所要求的行为并不完全清楚。但是,如果要在整个项目上设置单击侦听器,可以使用RecyclerView.ViewHolder.itemView
:
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {...}
}