On Fri, Aug 12, 2011 at 6:03 PM, Ian Dees <[email protected]> wrote: > Apparently we have said books somewhere in the office here but no one's > willing to say who has them for fear of not getting them back :).
Check underneath the break room table -- it might be propping up a short leg. Though if it's my digital books, they won't work well in that use case. > if I am going to do this in code/dynamically, how do I decide whether to add > 3 or 5? Coin flip! > What if the screen is really big and I want to put 10 fragment-thingers on > the screen in a 2x5 array? Do I lose the ability to have declarative layouts > (that survive orientation changes) with fragments? Nope. In fact, you will typically need to have declarative layouts anyway. Let's say that for large-screen devices you want 3 fragments in portrait and 5 in landscape. The same 3 are in both; landscape adds two more. In portrait, you'd use three <fragment> elements. In landscape, you'd also use three <fragment> elements, plus a pair of <FrameLayout> elements. Those latter two are the placeholders for where dynamic fragments will go. (technically they don't have to be FrameLayouts, but could be something else -- I've been delegating the positioning to other layouts and simply using FrameLayout as the "slot" to drop in a Fragment via a FragmentTransaction) So, you use the declarative layouts for all of the sizing and positioning and stuff, but you only declare the fixed fragments' contents declaratively, and the dynamic fragments' contents dynamically. Another approach, that I show in my introductory book, would have the same five <fragment> elements in both portrait *and* landscape, and you just make the Views for the extra two be View.GONE in portrait mode. This works, and avoids the FragmentTransactions, but it feels a bit clunky to me. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

