【发布时间】:2021-04-14 22:01:18
【问题描述】:
我有一个使用 Theme.AppCompat.Light 的应用程序,我需要使用它,因此对话框具有浅色主题。但这会使我工具栏中的文本变黑,而我宁愿它是白色的。我已经尝试将工具栏的特定app:theme 设置为AppCompat.Dark.Actionbar,但没有运气......我搜索了一段时间,找不到特定的问题和答案。
这是我的默认 AppTheme:
<style name="AppTheme.Parent" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/blue</item>
<item name="colorPrimaryDark">@color/dark_blue</item>
<item name="colorAccent">@color/pink</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style>
这是我的 toolbar.xml:
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="@dimen/abc_action_bar_default_height_material"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
【问题讨论】:
-
您是否尝试在工具栏上设置
style属性? -
@Gaëtan 刚刚尝试过,同样的问题。