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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to