Navigation drawer menu icon is not displayed correctly

后端 未结 3 440
名媛妹妹
名媛妹妹 2021-02-05 19:35

I want to input my customized icon into the menu in navigation drawer. However, when I run the application it only display a shadow of icon. How do I show the image correctly?

相关标签:
3条回答
  • 2021-02-05 20:01

    It works now by removing the tint effect from icon by setItemIconTintList(null). Put the line of code below under the navigationView.

     NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
     navigationView.setItemIconTintList(null);
     navigationView.setNavigationItemSelectedListener(this);
    
    0 讨论(0)
  • 2021-02-05 20:07

    Did you try to change to another image to see if it is displaying?

    <item name="ic_recent_picture" type="drawable">@mipmap/ic_recent</item>
    

    Path @mipmap contains correct image?

    0 讨论(0)
  • 2021-02-05 20:23

    if you still haven't solved the problem by removing the tint, you might want to move your resource file to drawable (use Poject View) instead of drawable-anydpi like I did

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