Android 支持库 22.2.1 与 22.2.0 中的工具栏文本大小

Toolbar text size in Android Support Library 22.2.1 vs 22.2.0

另一个基于 Chris Banes's cheesesquare 演示的问题。

更新到最新版本的库后,我不禁注意到工具栏文本大小在未折叠时的显着差异。

上一版本,22.2.0: 当前版本 22.2.1:

这种增加的原因是什么,最重要的是我如何覆盖它?

是否可以通过使用 xml 属性轻松设置所需的大小,或者是否需要定义和使用特定样式?

备注

无论哪种方案,都不会影响工具栏收起时的文字大小。只有当它展开时,就像上面的截图一样。

您需要为 CollapsingToolbarLayout 定义自定义样式:

<style name="CustomToolbar">
    <item name="android:textSize">@dimen/expanded_title_size</item>
</style>

然后使用setExpandedTitleTextAppearance方法应用它:

myCollapsingToolbar.setExpandedTitleTextAppearance(R.style.CustomToolbar);