I want to have a different layout for the landscape and portrait. But both orientations end up using the same xml layout. I ran into over a dozen questions at StackOverflow, but none of them solve my problem.
In the layouts there is a file activity_main.xml . I have folders for different terrain layouts, as indicated in this :
layout/ activity_main.xml layout-land-hdpi/ activity_main.xml layout-land-ldpi/ activity_main.xml layout-land-mdpi/ activity_main.xml layout-small-land-ldpi/ activity_main.xml
They have the same activity_main.xml file, except that the background color is different.
I do not have android:configChanges installed in AndroidManifest.xml for Activity. I do not override onConfigurationChanged() since I do not manually deal with orientation changes.
I use the actionbarsherlock library in the project. I created action-style themes using the ActionBar Sytele Generator .
minSdk and TargetSdk from AndroidManifest.xml:
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17" />
I run the code on emulators running Android 4.3 (Galaxy Nexus), Android 4.2.2 (Nexus 7) and Android 2.3.3 (Nexus S). The result is the same.
Is there something that I am not doing right?
Thanks!
source share