Inflating a layout containing StaggeredGridView causes "too much work on main thread" warnings
nucleartide opened this issue · 1 comments
nucleartide commented
I've timed the onCreateView()
of a fragment containing a StaggeredGridView, and logcat displays the following:
05-31 19:38:03.818 27544-27544/com.nucleartide.test.app D/SomeFragment﹕ Fragment inflation: 0.500305176 seconds
05-31 19:38:03.828 27544-27544/com.nucleartide.test.app D/SomeFragment﹕ onCreateView(): 0.524261475 seconds
05-31 19:38:03.828 27544-27544/com.nucleartide.test.app I/Choreographer﹕ Skipped 42 frames! The application may be doing too much work on its main thread.
05-31 19:38:04.648 27544-27544/com.nucleartide.test.app I/Choreographer﹕ Skipped 45 frames! The application may be doing too much work on its main thread.
With StaggeredGridView removed, inflating the same fragment is noticeably snappier. Also, the "Choreographer" lines do not appear:
05-31 19:43:04.341 28584-28584/com.nucleartide.test.app D/SomeFragment﹕ Fragment inflation: 0.009277345 seconds
05-31 19:43:04.351 28584-28584/com.nucleartide.test.app D/SomeFragment﹕ onCreateView(): 0.027099609 seconds
Is there anything that can be done about this?
nucleartide commented
Hmm, this is probably an issue with my item layouts, not the StaggeredGrid. Closing...