[英]Android - SearchView and overflow MenuItem icon colors
我的工具栏图标都是黑色的,除了SearchView
和溢出(三个点)图标,它们看起来是深灰色。
有没有办法将这些图标的色调设置为黑色以匹配我的其他图标?
这是我使用的主题,但据我所知,这没什么特别的。
<!-- Base application theme. -->
<style name="Theme.AnglersLog" parent="Base.Theme.AnglersLog">
</style>
<style name="Base.Theme.AnglersLog" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:logo">@android:color/transparent</item>
<item name="colorPrimary">@color/anglers_log_light</item>
<item name="colorPrimaryDark">@color/anglers_log_dark</item>
<item name="colorAccent">@color/anglers_log_accent</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
</style>
和工具栏
<android.support.design.widget.AppBarLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="@color/anglers_log_light"/>
</android.support.design.widget.AppBarLayout>
谢谢!
您需要像这样将主题添加到AppBarLayout
和Toolbar
:
<android.support.design.widget.AppBarLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar" >
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="@color/colorAccent"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.AppBarLayout>
或者如果你想要一个黑暗的主题:
<android.support.design.widget.AppBarLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/@style/ThemeOverlay.AppCompat.Dark.ActionBar" >
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="@color/colorAccent"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat" />
</android.support.design.widget.AppBarLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.