title: OnClickListener assigns only at first element of RecyclerView
body: <p>I'm creating my first app (TO-DO) which has a <strong>RecyclerView</strong> list of tasks. I want each task to have a delete button like in the picture:</p>
  
  <p><img src="https://i.stack.imgur.com/HQxHQ.png" alt="image"></p>
  
  <p>When I try to add an onClickListener, it does, but only for the item in position 0. </p>
  
  <p>Here is adapter code:</p>
  
  <pre><code>public class MainTabTasksAdapter extends RecyclerView.Adapter {
  
  private ArrayList&lt;Task&gt; tasks;
  private Context context;
  
  public MainTabTasksAdapter(Context context, ArrayList&lt;Task&gt; data) {
      tasks = data;
      this.context = context;
  }
  
  @Override
  public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
      View v = LayoutInflater.from(parent.getContext())
              .inflate(R.layout.fragment_task, parent, false);
      return new ViewHolder(v);
  }
  
  @Override
  public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
      Task task = tasks.get(position);
      ViewHolder holderCast = (ViewHolder) holder;
      holderCast.taskTag.setText(task.getTag());
      holderCast.taskTime.setText(task.getNiceDate());
      holderCast.taskRepeat.setText(task.getNiceRepeatInterval());
  //    holderCast.task = task;
  //    holderCast.position = position;
  }
  
  @Override
  public int getItemCount() {
      return tasks.size();
  }
  
  
  private class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
      Task task;
      int position;
      private TextView taskTag, taskTime, taskRepeat;
      private ImageView btnTomorrow, btnEdit, btnDelete;
  
      ViewHolder(View v) {
          super(v);
          taskTag = v.findViewById(R.id.task_tag);
          taskTime = v.findViewById(R.id.task_time);
          taskRepeat = v.findViewById(R.id.task_repeat);
          btnDelete = v.findViewById(R.id.task_btnDelete);
          btnDelete.setOnClickListener(this);
      }
  
      @Override
      public void onClick(View view) {
          int position = getAdapterPosition(); // Thanks cricket_007
      //    tasks.remove(task);
          tasks.remove(position);
          notifyItemRemoved(position);
      }
  }
  }
  </code></pre>
  
  <h1>UPDATE</h1>
  
  <p>Okay, the problem was floatingActionMenu which I found on a github.
  Even in the collapsed mode its size was the same when it was uncollapsed, and a click event occured on floatingActionButtons, but not on the buttons.</p>
  
  <p><img src="https://i.stack.imgur.com/ArL7l.png" alt="Uncollapsed">
  <img src="https://i.stack.imgur.com/EH3FH.png" alt="Collapsed"></p>