为 Firebase RecyclerView 添加触摸监听器

Add on touch listener for Firebase RecyclerView

我尝试使用 firebase 添加一个 "on touch" 监听器到 recyclerview,但未能成功。谁能帮帮我?

    DatabaseReference ref = FirebaseDatabase.getInstance().getReference();

        DatabaseReference a = ref.child("ufile").child(unique_id).child("Files");

        final FirebaseRecyclerAdapter<usersinfo,MessageViewHolder>adapter =
                new FirebaseRecyclerAdapter<usersinfo, MessageViewHolder>(usersinfo.class,android.R.layout.two_line_list_item,MessageViewHolder.class,a) {
                    @Override
                    protected void populateViewHolder(MessageViewHolder viewHolder, usersinfo model, int position) {
                        viewHolder.mtext.setText(model.username);

                    }


                };

      rvdb.setAdapter(adapter);



    public  static class  MessageViewHolder extends RecyclerView.ViewHolder {
TextView mtext;
        public MessageViewHolder(View itemView) {
            super(itemView);

          mtext = (TextView) itemView.findViewById(android.R.id.text1);
        }
    }
    public void retriveinfo(String username, String adress,String unique_id){
        DatabaseReference mDatabase;

        mDatabase = FirebaseDatabase.getInstance().getReference();
        usersinfo newuser= new usersinfo(username,adress);

    }

populateViewHolder 中,您可以像这样向 ViewHolder 添加点击侦听器:

// itemView is a public field of all ViewHolder classes
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
      // Your code here...
    }
});