5

I have linearlayout that with horizontal orientation.

I am adding ImageView item in it with inflating ImageViews. How can I check if there is no more space in the linear layout ?

For example in small screens I will add only 5 items but on big screens I will add up to 8. (depending of the size of the screen)

Lukap
  • 31,523
  • 64
  • 157
  • 244
  • (loopcount + 1) * imageWidth > linearLayoutHeght then break the loop. If you are starting the loop from 0 :) – Triode Apr 16 '13 at 10:33
  • Can you give me some snippet of link of how you measured the size ? , cause getWidth() returns 0 – Lukap Apr 16 '13 at 11:49
  • http://stackoverflow.com/questions/2827079/measuring-a-view-before-rendering-it see this link – Triode Apr 16 '13 at 11:52

1 Answers1

2

You can maybe take a look at this example.

http://hzqtc.github.io/2013/12/android-custom-layout-flowlayout.html