AppCompat toolbar font size is not compatible with portrait and landscape

I use this: https://xisberto.wordpress.com/2014/11/08/how-to-combine-actionbar-and-preferenceactivity-headers-with-appcompat/

enter image description hereenter image description here

The font size of the β€œSettings” changes between portrait and landscape. How can I keep it consistent?

+3
source share
2 answers

This is normal, the height of the toolbar in portrait mode is 56 dp, in the landscape of 48 dp, the OS changes its height. Be careful if you change the size of the title in the landscape, because you can place it higher than the toolbar.

+2
source

,

: titleTextAppearance

XML:

<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" />

:

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

0

All Articles