Android: How to use an xml string value to determine layout orientation
<p>I have a simple linear layout that I would like to change based on the screen size of the device. What I am trying to do is something like</p>

<p><code>
LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"<br>
    android:orientation="@string/cover_orientation"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"/>
</code></p>

<p>I have created different dimen.xml files under values and values-xlarge so that the <code>cover_orientation</code> variable will take on a different value (either 'vertical' or 'horizontal') based on the screen size. </p>

<p><code>
string name="cover_orientation">"vertical"
</code></p>

<p>But this doesn't work. I have found a temporary work around that involves checking the screen size and changing the orientation manually:</p>

<p><code>
if(getResources().getString(R.string.screen_size) == "xlarge"){
    ((LinearLayout)convertView).setOrientation(1);
}
</code></p>

<p>but it seems like you should be able to do it the first way (much more elegant/less code).</p>

<p>I considered just having a different layout for each screen size, but the layout is actually quite big and this is the only change I need for the different screen sizes. So it didn't make much sense to me to duplicate the entire layout.</p>

<p>Thanks!</p>
