Próbuję użyć widgetu paska narzędzi w Androidzie 21 z niestandardowym stylem, ale nie mogę „pozbyć się tego błędu:
Failed to find style "toolbarStyle" in current theme
.
Oto mój plik xml układu:
<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" />
Oto temat pacjenta:
<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>
Próbowałem też dodać toolbarStyle
w temacie mojego tematu, ale nie znam możliwych wartości.
Odpowiedzi:
19 dla odpowiedzi nr 1Możesz użyć stylu Widget.AppCompat.Toolbar.
<!-- Toolbar styles -->
<item name="toolbarStyle">@style/Widget.AppCompat.Toolbar</item>
31 dla odpowiedzi nr 2
Wystąpił ten sam problem, chociaż mój xml był poprawny. Rozwiązaniem było: Ustaw motyw AppCompat w temacie Wybierz pole wyboru, patrz fot.