material-components / material-components/material-components-android
[NavigationView] isVisible does not completely hide/show items
@hunterstich is already working on this.
Since Apr 26, 2022.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
**Description:**
I have a problem with the menu of a `NavigationView`: i want to hide menu-items and re-show them later (e.g. login/logout buttons).
but when setting
```kotlin
menu.findItem(R.id.nav_login)?.isVisible = !isLoggedIn
menu.findItem(R.id.nav_logout)?.isVisible = isLoggedIn
```
the login-item is getting *invisible* instead of *gone* (and the logout-item does not show up at all).
To get it working, I need to click on an other item. and this other item needs to be in a group with `android:checkableBehavior="single"` (my login/logout items are in a group with `none`).
**Expected behavior:**
Items set to invisible should be *gone* and re-appear when set to be visible again without the need of clicking on an item in a `android:checkableBehavior="single"`-group.
**Material Library version:** 1.2.0-alpha04
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.