Fixed
Status Update
Comments
il...@google.com <il...@google.com> #2
NavigationUI
always will ignore destinations that don't have any label at all (effectively just keeping whatever label was last set).
That being said, we think there's some value in distinguishing between no label at all (not using android:label
) and using an empty label (android:label=""
), so we'll make a change in Navigation to support setting empty labels. As a workaround, you can use android:label=" "
to set a visually empty label.
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-master-dev
commit d70854fa4233bb9c8b7c08b2a06b74e0e2b34b58
Author: Ian Lake <ilake@google.com>
Date: Wed Mar 04 16:19:46 2020
Allow NavigationUI to set empty labels
Instead of treating null labels and empty labels
the same (ignoring both), allow NavigationUI
to set an empty label.
This means that developers no longer need to use
android:label=" " to visually clear out the label.
Test: updated test, ran in sample app
BUG: 148679860
Change-Id: Id1352845a30a094497defc82038e57a1bd4caa7a
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavInflaterTest.kt
M navigation/navigation-runtime/src/androidTest/res/navigation/nav_simple.xml
M navigation/navigation-ui/src/main/java/androidx/navigation/ui/AbstractAppBarOnDestinationChangedListener.java
https://android-review.googlesource.com/1250942
Branch: androidx-master-dev
commit d70854fa4233bb9c8b7c08b2a06b74e0e2b34b58
Author: Ian Lake <ilake@google.com>
Date: Wed Mar 04 16:19:46 2020
Allow NavigationUI to set empty labels
Instead of treating null labels and empty labels
the same (ignoring both), allow NavigationUI
to set an empty label.
This means that developers no longer need to use
android:label=" " to visually clear out the label.
Test: updated test, ran in sample app
BUG: 148679860
Change-Id: Id1352845a30a094497defc82038e57a1bd4caa7a
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavInflaterTest.kt
M navigation/navigation-runtime/src/androidTest/res/navigation/nav_simple.xml
M navigation/navigation-ui/src/main/java/androidx/navigation/ui/AbstractAppBarOnDestinationChangedListener.java
il...@google.com <il...@google.com> #4
This has been fixed internally and it'll be available in Navigation 2.3.0-alpha04
, after which setting an android:label=""
will cause that destination to always have an empty label, whether going to that destination in the first case or coming back after popping the back stack.
Description
Version used: 2.2.0
Devices/Android versions reproduced on: 10
Using fragment navigation graph and Android appbar if you not label your fragment it will lost its empty title state when you navigate. Going back to the non labeled fragment you will see the title of the popped fragment as it's toolbar title.