java - 请问如何设置toolbar里的DrawerLayout按钮的颜色?
PHP中文网
PHP中文网 2017-04-18 09:52:33
0
2
500

就是上图那个按钮

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
洪涛

SetIcon

阿神

By default you should use style.xml中的AppTheme主题(这个可以在AndroidManifest.xml as seen in). Assuming that is the case, then you can change the color of the drawer button by:

  1. Enterstyle.xml;

  2. Add an inheritance from Widget.AppCompat.DrawerArrowToggle的style,这里叫做"DrawerArrowStyle"。在里面加上你想要的颜色,这里比如@color/colorBlue;

  3. Add a line named drawerArrowStyle to style "AppTheme".

In this way, style has the following two items:

<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>

Run it again and you will see the result.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!