简体   繁体   English

如何更改抽屉图标的颜色?

[英]How can I change the color of the drawer icons?

How can I change the color of the drawer icons ?如何更改抽屉图标的颜色? it is currently white, and I want it in black.它目前是白色的,我想要黑色。

drawer: new Drawer(
    child: new ListView(
      children: <Widget>[
        new UserAccountsDrawerHeader(
            accountName: Text('test'),
            accountEmail: Text('test'))

Define a new style for your icon style.xml file:为您的图标style.xml文件定义一个新样式:

<style name="DrawerIconStyle" parent="@style/Widget.AppCompat.DrawerArrowToggle">
       <item name="spinBars">true</item>
       <item name="color">@android:color/white</item>
</style>

and add it to your page theme (in same file):并将其添加到您的页面主题(在同一文件中):

<style name="Your.Theme" parent="Theme.AppCompat.NoActionBar">
    ...

    <item name="drawerArrowStyle">@style/DrawerIconStyle</item>

    ...
</style>
@override
Widget build(BuildContext context) {
  return new Scaffold(
    drawer: new Drawer(),
    appBar: new AppBar(
      title: new Text("Navigation Drawer"),
      iconTheme: new IconThemeData(color: Colors.green),
    ),
  );
}

Please let me know if it works.请让我知道它是否有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM