Verwenden Sie die Ansichtsbindung im Fragment

private FragmentJavaPracticeBinding binding;

@Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        binding = FragmentJavaPracticeBinding.inflate(inflater,container,false);
        return binding.getRoot();
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        binding.notesRecyclerView.setVisibility(View.VISIBLE);//this hide/show recyclerview visibility 
        Log.d("TAG", "hidden: ");
    }
Sudarshaana