tomss
tomss

Reputation: 371

Icons on NavigationView Items

I want to know if it is possible to use my own icons on NavigationView items. enter image description here

I tried to replace google icons to my own icons (drawable resources), but a square appears instead of my icons.

Upvotes: 0

Views: 455

Answers (2)

Kingfisher Phuoc
Kingfisher Phuoc

Reputation: 8200

Yes, you can. Look at this Answer

initImageLoader(this);
NavigationView navigationView = (NavigationView) findViewById(R.id.navigation);
ImageView imageView = (ImageView)navigationView.getHeaderView(0).findViewById(R.id.ivHeader);
ImageLoader.getInstance().displayImage("YourImageUrl", imageView);

Upvotes: 0

Rajan Kali
Rajan Kali

Reputation: 12953

After applying your own icons to the menu which is populated in Navigation Drawer, just add following piece of code in Activity.java file after initiating Nav drawer like

  NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
  navigationView.setItemIconTintList(null);

Upvotes: 1

Related Questions