Search code examples
androidperformanceandroid-viewviewgroup

android performance: lots of views vs viewgroup with lots of children


With android, is there a performance difference with having lots of views vs having viewgroups with childen?

From what I've read it seems that lots of views is bad for performance in general, and I was wondering if Viewgroups were a way around that


Solution

  • Short answer, no. A ViewGroup is a View and is the parent class to Android's various Layout type views. http://developer.android.com/reference/android/view/ViewGroup.html

    So, a ViewGroup is not a way around having a lot of views.

    In general, you want to make your layouts as clean & efficient as possible using the fewest amount of view you need to implement your UI.

    It may benefit you to read the Android documentation about optimizing layout hierarchies: http://developer.android.com/training/improving-layouts/optimizing-layout.html