Skip to content Skip to sidebar Skip to footer

Appcompat Toolbar Font Size Inconsistent In Portrait Vs. Landscape

I'm using this: https://xisberto.wordpress.com/2014/11/08/how-to-combine-actionbar-and-preferenceactivity-headers-with-appcompat/ The 'Settings' font size changes between portrai

Solution 1:

It is normal, the toolbar height in portrait mode have 56 dp, in landscape 48 dp, the OS resize its height. Take care if you change the title size in landscape because you can put it higher than the toolbar.

Solution 2:

Need to override toolbar title text size by adding

app:titleTextAppearance

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

Toolbar Style:

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

Answer taken from here

Post a Comment for "Appcompat Toolbar Font Size Inconsistent In Portrait Vs. Landscape"