-1

When i get the data from Json And put in the recyclerview. It is scrolling very slowly? Plz Help me to solve this solution.

recyclerView = findViewById(R.id.recycleview);
            adapter1 = new Landing_recycler_adapter(MainActivity.this, movieList);
            GridLayoutManager gridLayoutManager = new GridLayoutManager(getApplicationContext(),2);
            gridLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); // set Horizontal Orientation
            recyclerView.setLayoutManager(gridLayoutManager); // set LayoutManager to RecyclerView
    //        recyclerView.setLayoutManager(new GridLayoutManager(this, GridLayoutManager.HORIZONTAL, true));


            recyclerView.setHasFixedSize(true);
            recyclerView.setAdapter(adapter1);

            getJsonData();
mohammadReza Abiri
  • 1,759
  • 1
  • 9
  • 20

2 Answers2

0

use this

            getJsonData();
            recyclerView = findViewById(R.id.recycleview);
            adapter1 = new Landing_recycler_adapter(MainActivity.this, movieList);

            recyclerView.setLayoutManager(new LinearLayoutManager(this));
            recyclerView.setAdapter(adapter1);

or

            getJsonData();
            recyclerView = findViewById(R.id.recycleview);
            adapter1 = new Landing_recycler_adapter(MainActivity.this, movieList);

            recyclerView.setLayoutManager(new GridLayoutManager(this,2));
            recyclerView.setAdapter(adapter1);

kam1234
  • 574
  • 2
  • 5
  • 9
0

And also disable nested scrolling of RecyclerView

recyclerView.setNestedScrollingEnabled(false);
Kuvonchbek Yakubov
  • 558
  • 1
  • 6
  • 16