2

I have a ViewGroup gallery in my app, and every child view is as large as the parent. This means that the parent can only show one child view at a time. However, outside the screen there may be 10 or 20 other child views that are still in this viewgroup - they are just outside of visible rect, but not set to invisible.

Do these views worsen the performance of the viewgroup (when drawing, touch event or sth)? Do more views mean worse performance?

Shade
  • 9,936
  • 5
  • 60
  • 85

1 Answers1

3

Do more views means less performance?

Yes, just like the more tabs you have open in your browser means a slower experience browsing the web. There is no hard-set rule that dictates 10 Views is too many or even 50, every View consumes a different amount of resources and every device handles a different capacity before slowing down. But if you over-react by adopting a minimalist design practice you could make a horrible user experience. (Imagine going back to only using one tab in your browser or any other program...)

So the trick is to strike a happy medium between features and responsiveness.


Android's DDMS tool will help you figure out how much memory your app consumes and how quickly it responds. This is the best way to determine whether you have room to add more "bells and whistles" or if you should "cut the fat".

Sam
  • 86,580
  • 20
  • 181
  • 179
  • is there performance difference when these child views are in view hierarchy or not? my situation is child views amount is fixed, but I want to know when I add them to there parent, the performance will or will not reduce? – user2170245 Mar 15 '13 at 13:24
  • remember only one child view is visible at one time. – user2170245 Mar 15 '13 at 13:26
  • is there maintenance cost when views are added to its parent(but out of visible rect)? – user2170245 Mar 15 '13 at 13:27
  • You seem to have very specific questions. It will be faster to open the DDMS Perspective in Eclipse and run these tests yourself. (You already have the app.) Then you'll have your answers in a couple minutes. The short answer is that if you created an object: it will consume resources. Will it slow your app down? Not necessarily, again there is no concrete rule for this. – Sam Mar 15 '13 at 20:04