jmartinesp / SpannedGridLayoutManager

Android RecyclerView.LayoutManager that resizes and reorders views based on SpanSize
MIT License
600 stars 105 forks source link

Unable to create inside of a fragment #29

Closed mrsylerpowers closed 6 years ago

mrsylerpowers commented 6 years ago

When I copy the same code that from a this repo to a fragment and execute

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_feed, container, false);
        SpannedGridLayoutManager spannedGridLayoutManager = new 
        SpannedGridLayoutManager(SpannedGridLayoutManager.Orientation.VERTICAL, 3);

        RecyclerView recyclerView = view.findViewById(R.id.list_items);
        recyclerView.setLayoutManager(spannedGridLayoutManager);
        recyclerView.setAdapter(new ItemsAdapter());
        return view;

It shows up with nothing in it and when I move the exact same code to an activity it shows up perfectly