Navigation Drawer listview not refreshing listitems

自作多情 提交于 2019-12-01 21:43:06

You shouldn't try to hide the drawer items. I would just update the adapter, remove the items you don't need and then invalidate it.

When the user clicks on Signout, I would just do something like this:

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    // display view for selected nav drawer item
    displayView(position);

    // if using fixed positions
    if(position == 6) { // position of Sign out button

        navDrawerItems.clear(); // empty the adapter array
        navDrawerItems.add(new NavDrawerItem(navMenuTitles[signoutIndex], navMenuIcons.getResourceId(signoutIndex, -1));
        adapter.notifyDataSetChanged();

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