I've been looking at issues in stackoverflow and I've tried everything I've seen but the layout-land not work.
In my code I have and the method onConfigurationChanged
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
And the manifest file:
<activity
android:name="com.sde.PlayerTrack"
android:theme="@style/AppTheme"
android:configChanges="orientation|keyboardHidden|screenSize"
>
</activity>
I tried also to remove in the android manifest entry: configChanges and then the layout land load but the components i have (TextView, scrollbar ...) does not work properly.
Can you help me, please?
Remove orientation
from the android:configChanges
in your manifest file, and put you landscape layout xml file into layout-land
folder.
Finally, my solution is:
AndroidManifest.xml File:
<activity
android:name="activity.name"
android:configChanges="orientation|keyboardHidden|screenSize"
>
And in the activity implement the method onConfigurationChanged (Configuration newconfig):
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
createHorizontalalLayout();
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
createVerticalLayout();
}
}
With createVerticalLayout () and createHorizontalLayout () programmatically do the layouts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With