Android Fragment 中的 Recycler 和 ButterKnitfe 错误

Android Recycler and ButterKnitfe error in Fragment

  1. ButterKnife.bind(这​​个)错误
private void bindButterKnife() {

        ButterKnife.bind(this);
    }
  1. (this, new ArrayList()) and (new LinearLayoutManager(this));错误
private void setUserRecyclerView() {
    mUsersChatAdapter = new UsersChatAdapter(this, new ArrayList<User>());
    mUsersRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mUsersRecyclerView.setHasFixedSize(true);
    mUsersRecyclerView.setAdapter(mUsersChatAdapter);
}

谁能帮帮我

  1. 覆盖 onViewCreated 并使用 ButterKnife 作为 ButterKnife.bind(this, view)
  2. 使用getActivity()代替this

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
          super.onViewCreated(view, savedInstanceState);
          ButterKnife.bind(this, view);
    }