Search code examples
androidlandscape-portraittabbed

Android - Layout and Layout-land not changing right away


I have a simple tabbed application and I would like to change the layout when the device is in landscape mode. I have found how to do that but it does not update to the new layout out until I go between tabs.

This is not the intended behavior any way to fix this?


Solution

  • I found out that I need to recreate the tabs to change the layout file that they were using. I used the onConfigurationChanged method to text for the change in orientation.

    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
    

    Then I just recreated the tabs like I created them the first time and everything worked just as planned.