I have an ImageView in CardViews of my RecyclerView.
I would like to catch the onClick on the ImageView, like I already did with the ListView. So, in the public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) I tried with:
myViewHolder.imageView.setClickable(true);
myViewHolder.imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d("TEST", "Clicked");
}
but this was totally ignored. The following code is working:
myViewHolder.imageView.setImageResource(R.drawable.star_yellow);
What can I do?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…