Android Material Design:无法在当前主题中找到样式"toolbarStyle" [英] Android Material Design: Failed to find style 'toolbarStyle' in current theme

查看:73
本文介绍了Android Material Design:无法在当前主题中找到样式"toolbarStyle"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试以自定义样式使用android 21中的工具栏小部件,但无法摆脱此错误: Failed to find style 'toolbarStyle' in current theme.

I am trying to use the toolbar widget in android 21 with a custom style but I can't get rid off this error : Failed to find style 'toolbarStyle' in current theme.

这是我的布局xml文件:

Here is my layout xml file :

 <android.support.v7.widget.Toolbar
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/patient_toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:theme="@style/AppTheme.Patient" />

以下是患者"主题:

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
    <!-- Customize your theme here. -->
</style>

<style name="AppTheme.Patient" parent="AppTheme">
    <item name="colorPrimary">@color/patient_primary</item>
    <item name="colorPrimaryDark">@color/patient_primary_dark</item>
    <item name="colorAccent">@color/patient_accent</item>
    <item name="toolbarStyle"></item> <!-- what values to put here -->
</style>

我也尝试在主题的项目中添加toolbarStyle,但是我不知道可能的值.我想念什么吗?

I also tried to add toolbarStyle in item in my theme but I don't know the possible values. Am I missing something?

推荐答案

您可以使用Widget.AppCompat.Toolbar样式.

You can use the style Widget.AppCompat.Toolbar.

<!-- Toolbar styles -->
    <item name="toolbarStyle">@style/Widget.AppCompat.Toolbar</item>

这篇关于Android Material Design:无法在当前主题中找到样式"toolbarStyle"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆