Understanding RecyclerView setHasFixedSize

后端 未结 8 2011
闹比i
闹比i 2020-11-28 01:52

I\'m having some trouble understanding setHasFixedSize(). I know that it is used for optimization when the size of RecyclerView doesn\'t change, fr

8条回答
  •  情深已故
    2020-11-28 02:26

    If the size of the RecyclerView (the RecyclerView itself)

    ... does not depend on the adapter content:

    mRecyclerView.setHasFixedSize(true);
    

    ...depends on the adapter content:

    mRecyclerView.setHasFixedSize(false);
    

提交回复
热议问题