扫码关注官方订阅号
就是上图那个按钮
认证高级PHP讲师
SetIcon
默认情况下你应该使用的是style.xml中的AppTheme主题(这个可以在AndroidManifest.xml中看出来)。假设是这样,那么你可以通过以下方法改变 drawer 按钮的颜色:
style.xml
AppTheme
AndroidManifest.xml
进入style.xml;
增加一种继承自Widget.AppCompat.DrawerArrowToggle的style,这里叫做"DrawerArrowStyle"。在里面加上你想要的颜色,这里比如@color/colorBlue;
Widget.AppCompat.DrawerArrowToggle
@color/colorBlue
在 style "AppTheme" 中增加一行名为 drawerArrowStyle 的这种 style。
这样一来,style 中便有如下两项:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> ... <item name="drawerArrowStyle">@style/DrawerArrowStyle</item> </style> <style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle"> <item name="color">@color/colorBlue</item> </style>
再运行你就看到结果了。
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
SetIcon
默认情况下你应该使用的是
style.xml中的AppTheme主题(这个可以在AndroidManifest.xml中看出来)。假设是这样,那么你可以通过以下方法改变 drawer 按钮的颜色:进入
style.xml;增加一种继承自
Widget.AppCompat.DrawerArrowToggle的style,这里叫做"DrawerArrowStyle"。在里面加上你想要的颜色,这里比如@color/colorBlue;在 style "AppTheme" 中增加一行名为 drawerArrowStyle 的这种 style。
这样一来,style 中便有如下两项:
再运行你就看到结果了。