Change the Arrow Icon in the Drawer Menu?

前端 未结 2 1882
情话喂你
情话喂你 2021-01-28 04:47

I am using Android Studio. And I created a new activity with a navigation drawer. But, It\'s showing the <- instead of the Hamburger Icon.

How can I modify my code t

相关标签:
2条回答
  • 2021-01-28 05:03

    Add Following code in Your theme.

    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
    </style>
    
    <style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
        <item name="spinBars">true</item>
        <item name="color">@android:color/white</item>
    </style>
    
    0 讨论(0)
  • 2021-01-28 05:09
    1. use android.support.v7.app.ActionBarDrawerToggle instead of android.support.v4.app.ActionBarDrawerToggle

    2. you will get an error for the constructor of ActionBarDrawerToggle. Use the constructor for ActionBarDrawerToggle v7 with 4 parameters.

    3. Also add this to your styles.xml

      <style name="AppTheme" parent="Theme.AppCompat.Light">
        <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
      </style>
      
      <style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
        <item name="spinBars">true</item>
      </style>
      

    4.Apply this theme to your application in the manifest. Hope this helps.

    0 讨论(0)
提交回复
热议问题