0

I have set configChanges="orientation|landscape" to keep Activity instance after rotation but now the title size in action bar not changes after rotation. I'm using AppCompat. I'm trying to hide and show title again in onConfigurationChanged:

public void onConfigurationChanged (Configuration newConfig)
{
    super.onConfigurationChanged(newConfig);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    getSupportActionBar().setDisplayShowTitleEnabled(true);
}

And this not help. How to set the title size changing after rotation?

I want to do something like this: Portrait Landscape

Images taken from this question: Android Toolbar: small title text in landscape mode

Community
  • 1
  • 1
krystian71115
  • 1,927
  • 17
  • 36

1 Answers1

1

The style of the title is in a configuration-specific XML file. If you don't recreate the view on configuration change, it will just stay as it is.

Solution: recreate the Activity on configuration change, or use a Fragment with setRetainInstance(true) which will be preserved while its view is re-created.

BladeCoder
  • 12,779
  • 3
  • 59
  • 51