There is an Activity with ViewPager . In one of the Page there is a fragment with RecyclerView . There I set both the LayoutManager and ScrollListener in the onCreateView method. All is well. I android:configChanges="screenSize" on android:configChanges="screenSize" , in order to prevent it from being recreated when changing orientation. So, how to change the orientation again call LayoutManager , etc,? For example, GridAutofitLayoutManager columns were calculated in the GridAutofitLayoutManager ? tried this:
public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Integer minWidth; minWidth = (int) getResources().getDimension(R.dimen.minItemWidht); Log.d("TAG ", String.valueOf(minWidth)); layoutManager = new GridAutofitLayoutManager(context, minWidth); mRecyclerView.setLayoutManager(layoutManager); } But it did not help. During debug everything is fine, GridAutofitLayoutManager calculates the number of new columns. As soon as you remove the stop point, it stops. Perhaps not enough time?
Here is the code GridAutofitLayoutManager
totalSpice somehow sometimes incorrectly calculates