问题
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 portrait and landscape. How do I keep it consistent?
回答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.
回答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:
<style name="ToolbarTitle" parent="@style/TextAppearance.Widget.AppCompat.Toolbar.Title">
<item name="android:textSize">20sp</item>
</style>
Answer taken from here
来源:https://stackoverflow.com/questions/28486858/appcompat-toolbar-font-size-inconsistent-in-portrait-vs-landscape