在Android工具栏中更改背面和清除图标的SearchView颜色

在Android工具栏中更改背面和清除图标的SearchView颜色,第1张

概述我想在SearchView崩溃时自定义后退和清除图标.我的要求是将颜色更改为白色,但现在是黑色.(请参阅下面分享的图像).我希望解决这个问题几天,但我尝试过的解决方案都没有解决.我尝试了几个从SO建议的解决方案,如下所示: 解决方案1: <style name="AppTheme" parent="@style/Theme.Base.AppCompat.Light.DarkActionBar"> 我想在SearchVIEw崩溃时自定义后退和清除图标.我的要求是将颜色更改为白色,但现在是黑色.(请参阅下面分享的图像).我希望解决这个问题几天,但我尝试过的解决方案都没有解决.我尝试了几个从SO建议的解决方案,如下所示:

解决方案1:

<style name="Apptheme" parent="@style/theme.Base.AppCompat.light.DarkActionbar">    <item name="actionbarWidgettheme">@style/YourActionbarWidget</item></style><style name="YourActionbarWidget" parent="@style/theme.AppCompat">    <item name="searchVIEwCloseIcon">@drawable/xxx</item></style>

解决方案2:

final Drawable upArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_Alpha);upArrow.setcolorFilter(getResources().getcolor(R.color.WHITE),PorterDuff.Mode.SRC_Atop);getSupportActionbar().setHomeAsUpIndicator(upArrow);

我的项目styles.xml

<style name="Toolbartheme" parent="@style/theme.AppCompat.light">        <item name="colorPrimary">@color/blue</item>        <item name="colorPrimaryDark">@color/blue</item>        <item name="windowNoTitle">true</item>        <item name="windowActionbar">false</item>        <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>        <item name="androID:itemTextAppearance">@style/myCustomMenuTextApearance</item>        <item name="androID:actionMenuTextcolor">@color/white</item>        <item name="actionMenuTextcolor">@color/white</item>    </style><style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">        <item name="spinbars">true</item>        <item name="color">@color/white</item>        <item name="gapBetweenbars">2.5dip</item>        <item name="thickness">2dp</item>    </style>

我的确切问题的屏幕截图:

请帮我解决我的问题.任何类型的解决方案和建议对我都有帮助.感谢您的支持.

解决方法 如果您在工具栏上搜索白色图标
在工具栏标签上添加这些
androID:theme="@style/themeOverlay.AppCompat.Dark.Actionbar"
总结

以上是内存溢出为你收集整理的在Android工具栏中更改背面和清除图标的SearchView颜色全部内容,希望文章能够帮你解决在Android工具栏中更改背面和清除图标的SearchView颜色所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1130999.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存