如何在导航视图中取消选中已选中的项目? [英] How to uncheck checked items in Navigation View?

查看:86
本文介绍了如何在导航视图中取消选中已选中的项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道可以通过调用setCheckedItem()突出显示导航视图项,或者在onNavigationItemSelected中返回true值以将其显示为选定项,但是如何取消选中导航视图中已选中的项?

I know it's possible to highlight a navigation view item by calling setCheckedItem() or return true value in onNavigationItemSelected to display the item as the selected item, but How can I uncheck the checked items of a navigation view?

推荐答案

这将取消选中项目:

    int size = mNavigationView.getMenu().size();
    for (int i = 0; i < size; i++) {
        mNavigationView.getMenu().getItem(i).setChecked(false);
    }

这篇关于如何在导航视图中取消选中已选中的项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆