I'm a little nervous about setting it in code (also in onConfigurationChanged() ) for the reasons you mentioned. It just feels "tighter" to do it in the XML...
On Apr 20, 2:40 pm, Justin Giles <[email protected]> wrote: > I suppose you could change the orientation in code. After you assign the > view in your onCreate, do a check to see whether the user is on landscape or > portrait mode and set the orientation value accordingly. This should be a > bit more fool-proof than your method, however it could have its own > drawbacks in that it could cause shifting on the screen visible to the user. > Might be worth a try though. > > Justin > > On Tue, Apr 20, 2010 at 5:41 AM, westmeadboy <[email protected]>wrote: > > > > > > > I have a linear layout where the orientation needs to be "horizontal" > > in portrait mode and "vertical" in landscape mode. > > > There are a few ways to do this, the most obvious of which being to > > specify two layouts: one in "layout" and one in "layout-land". > > > However, this will require a certain amount of duplicate XML. I know > > you can use <include> to minimize this, but at the very least the > > attributes of the LinearLayout tag will need to be duplicated and two > > extra XML files need to be created (one layout-land file and one > > include for the contents of that layout). > > > As an alternative I do this in the LinearLayout tag: > > > android:orientation="@string/custom_lang_orientation" > > > and then: > > > values/strings.xml <string name="custom_lang_orientation">0</string> > > > values/strings-land.xml <string name="custom_lang_orientation">1</ > > string> > > > which is a hack. Its also a bit risky because of the assumption the > > integer values for horizontal/vertical will not change. However, I > > suppose this is extremely unlikely. > > > Any thoughts? > > > -- > > 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]<android-developers%2Bunsubs > > [email protected]> > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > 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 > athttp://groups.google.com/group/android-developers?hl=en -- 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

