android - 如何更改工具栏文字大小?

标签 android toolbar text-size

我想改变 Toolbar 中文字的大小。因为在我的应用程序中,Toolbar 文本在横向和纵向模式下都有不同的大小。

Toolbar中文字的文字大小可以改变吗?

最佳答案

使用 app:titleTextAppearance :

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="?actionBarSize"
    android:id="@+id/toolbar"
    app:titleTextAppearance="@style/Toolbar.TitleText" />

并以自定义样式覆盖默认标题大小:

<style name="Toolbar.TitleText" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
    <item name="android:textSize">18sp</item>
</style>

结果:

Screenshot

关于android - 如何更改工具栏文字大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28487312/

相关文章:

Android获取WebView高度

android - AndroidStudio 2.3 更新后 Robolectric 测试中的 RuntimeEnvironment.application

ios7 - iOS7 中的工具栏项目字体大小

android - CollapsingToolbarLayout/工具栏边距错误

android - Android Studio 和实际设备中的文本大小

button - 如何更改 flutter Material 按钮的字体大小?

Android AlertDialog按钮定位

android - AppBarLayout fitSystemtWindows =“true"在 layout_height 为 wrap_content 时不起作用

jquery - jquery如何改变对话框文本大小

android - flutter Android错误: ensureInitializationComplete must be called after startInitialization