Closed riontech-xten closed 8 years ago
header item's child click is not working
here is my code public HeaderViewHolder(View itemView) { super(itemView); this.textView = (TextView) itemView.findViewById(R.id.txtDateSection); itemView.findViewById(R.id.imgClickTest).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(context, "Position=>"+ getAdapterPosition(), Toast.LENGTH_LONG).show(); } }); }
public HeaderViewHolder(View itemView) { super(itemView); this.textView = (TextView) itemView.findViewById(R.id.txtDateSection); itemView.findViewById(R.id.imgClickTest).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(context, "Position=>"+ getAdapterPosition(), Toast.LENGTH_LONG).show(); } }); }
You have to check for click events by implementing RecyclerView.OnItemTouchListener. This was already discussed on issue #26 so please refer to that thread for the information you need.
RecyclerView.OnItemTouchListener
header item's child click is not working
here is my code
public HeaderViewHolder(View itemView) { super(itemView); this.textView = (TextView) itemView.findViewById(R.id.txtDateSection); itemView.findViewById(R.id.imgClickTest).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(context, "Position=>"+ getAdapterPosition(), Toast.LENGTH_LONG).show(); } }); }