Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recyclerview Performance #20

Open
dyangcoding opened this issue Jan 12, 2017 · 0 comments
Open

Recyclerview Performance #20

dyangcoding opened this issue Jan 12, 2017 · 0 comments

Comments

@dyangcoding
Copy link
Owner

1 recyclerView.setHasFixedSize(true), this do improve the profermance, only for the case that all item of view has fixed width and height.

2 recyclerView.setItemViewCacheSize(20);
recyclerView.setDrawingCacheEnabled(true);
recyclerView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
Not sure about this

3 set OnClickListener once in onCreateViewHolder() and call through an interface a listener outside of the Adapter, passing the clicked view. don't create extra objects all the time. Already done

4 by updateing adapter, consider do not collect all items all the time, take advantage of the following methods may help, not tests
adapter.notifyItemRangeInserted(rangeStart, rangeEnd)
adapter.setHasStableIds(true);
adapter.notifyItemRemoved(position);
adapter.notifyItemChanged(position);
adapter.notifyItemInserted(position);
this requires that data which to be served has unique ids.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant