android - 为什么NavigationDrawer中的Item点击之后一直停留在选中的状态?
高洛峰
高洛峰 2017-04-17 17:02:19
0
2
670
高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(2)
刘奇

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

//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;
            }
        });    
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!