android– 如何更改Action Bar Overflow按钮颜色

android– 如何更改Action Bar Overflow按钮颜色,第1张

概述首先我读了Changecoloroftheoverflowbuttononactionbar但是我无法让它发挥作用.我只是想有一个简单的主题:动作栏背景蓝色和按钮和文本白色.对于我所拥有的列表视图,我希望它们是相反的:白色背景和蓝色文本.如果有一个简单的方法来实现这一点,请告诉我.我尝试使用样式设置

首先我读了Change color of the overflow button on action bar但是
我无法让它发挥作用.

我只是想有一个简单的主题:动作栏背景蓝色和按钮和文本白色.对于我所拥有的列表视图,我希望它们是相反的:白色背景和蓝色文本.如果有一个简单的方法来实现这一点,请告诉我.
我尝试使用样式设置文本颜色,但我无法将文本和按钮设置为不同的颜色,所以我尝试设置溢出drawable并且为了测试目的,我将点设置为红色但看不到任何效果.

    <!-- Application theme. --><style name="Apptheme" parent="theme.AppCompat.light">    <item name="actionbarStyle">@style/ActionbarStyle</item></style><style name="ActionbarStyle" parent="Widget.AppCompat.Actionbar">    <item name="background">@color/background_blue</item>    <item name="TitleTextStyle">@style/Apptheme.Actionbar.Title</item>    <item name="actionOverflowbuttonStyle">@style/Apptheme.Actionbutton.Overflow</item></style><style name="Apptheme.Actionbar.Title" parent="TextAppearance.AppCompat.Widget.Actionbar.Title">    <item name="androID:textcolor">@color/white</item></style><style name="Apptheme.Actionbutton.Overflow"  parent="@style/Widget.AppCompat.Actionbutton.Overflow">    <item name="androID:src">@drawable/abc_ic_menu_overflow_button</item></style>

我正在用于测试的溢出按钮

虽然我看到了什么

显然没有使用红色按钮.

我能够使用androID:textcolorPrimary属性但是有不良副作用.

    <style name="Apptheme" parent="theme.AppCompat.light">    <item name="androID:textcolorPrimary">@color/white</item>    <item name="actionbarStyle">@style/ActionbarStyle</item></style><style name="ActionbarStyle" parent="Widget.AppCompat.Actionbar">    <item name="background">@color/background_blue</item>    <item name="TitleTextStyle">@style/Apptheme.Actionbar.Title</item></style><style name="Apptheme.Actionbar.Title" parent="TextAppearance.AppCompat.Widget.Actionbar.Title">    <item name="androID:textcolor">@color/white</item></style>

但是因为我希望我的列表有白色背景,所以我最终无法看到一些文字,因为文字和背景都是白色的.

谢谢!

解决方法:

我发现了另一种方法,不需要更换图像!

<style name="Apptheme" parent="theme.AppCompat.light">    <item name="actionbartheme">@style/Apptheme.Actionbartheme</item> <!-- used for the back arrow on the action bar --></style><style name="Apptheme.Actionbartheme" parent="@style/themeOverlay.AppCompat.Actionbar">    <!-- THIS is where you can color the arrow and the overflow button! -->    <item name="colorControlnormal">@color/splash_Title</item> <!-- sets the color for the back arrow -->    <item name="OverflowbuttonStyle">@style/overflowbuttonStyle</item> <!-- sets the style for the overflow button --></style><!-- This style is where you define the tint color of your overflow menu button --><style name="actionOverflowbuttonStyle" parent="@style/Widget.AppCompat.Actionbutton.Overflow">    <item name="androID:tint">@color/white</item></style>
总结

以上是内存溢出为你收集整理的android – 如何更改Action Bar Overflow按钮颜色全部内容,希望文章能够帮你解决android – 如何更改Action Bar Overflow按钮颜色所遇到的程序开发问题。

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

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

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

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

发表评论

登录后才能评论

评论列表(0条)

保存