Toolbar title bar decreases when orientation changes

The text of the toolbar title text is reduced when I change the orientation from portrait to landscape and get reset when I return to portrait. The activity in which this occurs continues ActionBarActivity, which uses getSupportActionBar().

+4
source share
2 answers

Use the solution below:

<android.support.v7.widget.Toolbar
        android:id="@+id/main_toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:titleTextAppearance="@style/ToolbarTitle"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

Toolbar Style:

<style name="ToolbarTitle" parent="@style/TextAppearance.Widget.AppCompat.Toolbar.Title">
        <item name="android:textSize">20sp</item>
</style>
+3
source

, android.support.v7.widget.Toolbar. . .

<style name="ToolbarText" parent="@style/TextAppearance.Widget.AppCompat.Toolbar.Title">
        <item name="android:textSize">17sp</item>
</style>

.

<android.support.v7.widget.Toolbar 

    ....
    app:titleTextAppearance="@style/ToolbarText" />
+2

All Articles