Disable a color tint in NavigationView only for specified icons

别来无恙 提交于 2019-12-05 15:37:58

问题


I need to disable a tint color for some icons in NavigationView because their color define category type. How can I do it?
Below picture shows my problem:


回答1:


navview.setItemIconTintList(null);

Good luck!




回答2:


If you want change color of icon on seletion the below is the possible answer:

Change Navigation View Item Color Dynamicly Android

Otherwise you can set

navview.setItemIconTintList(null);

this will give the original colors of icons. and you can use colored and grey icons as per your requirements.




回答3:


 Menu menuNav = navigationView.getMenu();
 MenuItem menuItem = menuNav.findItem(R.id.nav_subjects);

 // Disable a tint color
 menuItem.setChecked(false);

I hope it answers your question.



来源:https://stackoverflow.com/questions/36371536/disable-a-color-tint-in-navigationview-only-for-specified-icons

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!