Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1. class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
  2.  
  3.         View view;
  4.         TextView title,phone;
  5.         LinearLayout contact_select_layout;
  6.         ViewHolder(@NonNull View itemView) {
  7.             super(itemView);
  8.             view = itemView;
  9.             title= itemView.findViewById(R.id.contact_name);
  10.             phone= itemView.findViewById(R.id.contact_phone);
  11.             contact_select_layout=itemView.findViewById(R.id.contact_select_layout);
  12.         }
  13.  
  14.         @Override
  15.         public void onClick(View v) {
  16.             list.setSelected(!list.isSelected());
  17.             v.setBackgroundColor(
  18.                     list.isSelected()? Color.parseColor("#FF5722"):
  19.                             Color.parseColor("#070707"));
  20.         }
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement