>>>>> "KV" == Kostya Vasilyev <[email protected]> writes:
KV> 08.04.2011 19:25, Jake Colman пишет: >> I have a 2x1 widget with two textviews, aligned top and bottom to >> the baseline, that display fine in Portrait. When I switch to >> landscape, there is insufficient room for the two textviews (the >> widget becomes long and narrow) so the two textviews overlap each >> other. KV> Yep, there is typically less per-widget height in landscape mode. KV> One way to handle this is to use Launcher shortcut - sized KV> widgets, but those are pretty small. Making larger widgets KV> requires some more work: Yup, I plan on making a 1x1 widget available as well. >> What is the correct way to handle this? >> >> Do I need a create a 2x1 landscape layout so that Android will use >> that specific layout instead of reusing my one layout? KV> Yes, make a landscape version with the same name in res/layout-land. >> If so, and if that new layout uses one textview instead of two, >> how do I know at runtime which layout is being used? KV> You don't - especially since onUpdate doesn't get called for KV> widget orientation changes. So whatever you push out into the KV> widget with RemoteViews has to work for both orientations. KV> Resources do get reloaded though, so you can rely on resource KV> qualifiers like -land, etc. >> Or do I keep the code the same and uses the same IDs on both >> layouts and updating that second textview id won't hurt anything? KV> I'd keep both text views in both layout, using visibility="gone" KV> where a view is not supposed to show - just to be safe. KV> You could also use one text view, combining data from your KV> original two, in landscape mode. In that case, you'd have a total KV> of three views, and make portrait-only views "gone" in the KV> landscape layout, and vise versa. But if onUpdate is not called on changes to orientation, how do you know a) which layout to reference and b) which visibility to make "gone"? -- Jake Colman -- Android Tinkerer -- 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

