拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...
Find the xml file of your menu and change the checkableBehavior of the corresponding group from single to none.
The description of the problem is not clear enough and I don’t know what causes it. Solution: Add a click listener for the item and set the item's isChecked to false
isChecked
//navigationmenu是一个NavigationView对象 navigationmenu.getMenu().findItem(R.id.drawer_favourite).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { item.setChecked(false); //do something return false; } });
Find the xml file of your menu and change the checkableBehavior of the corresponding group from single to none.
The description of the problem is not clear enough and I don’t know what causes it.
Solution: Add a click listener for the item and set the item's
isChecked
to false