My Bottom NavBar Is Appearing on Splash Screen also how to avoid it I Used Animated Visibilty to false But It's Not looking Fine
Related
Please, help me to understand how to do it right.
I have an app, which represent a screen with bottom bar with 4 tabs (1st layer). From this tabs we can enter other screens (2nd layer) without bottom bar. This organized very simple, Scaffold with bottom bar and navigation host inside it. To open screens above 1st layer without navigation bar I searched and found that I can just hide bottom bar and then open the screen above.
This is good, but on slow devices an ugly animation happen when 1)bottom bar is going down (user see the old screen without bottom bar) and 2) new screen appears.
This is not pleasant, but.. ok.
The second thing that I cannot stand is when in a 1-st layer screen I have a ModalBottomSheetLayout. When it hidden - it hides right behind bottom navigation bar and when I am going to new screen bottom navigation animated down and... here you are - the ModalBottomSheetLayout, and only then the second screen come to the place.
I wonder, may be I understand everything wrong and the new screens shouldn't be organized like this? How to set up navigation and scene like before compose we have a main fragment with bottom nav bar and open fragments on the top?
The example of the code I am talking about can be found for example in app nowinandroid, I think this is very common case.. As I see they also just hide bottom bar when needed..
#Composable fun NiaApp...
Why im asking?
I'm calculating the height of the screen which is currently visible and if the bottom navigation bar is transparent i won't add its height since my screen view comes under it (since it's transparent) but if its filled then i have to add the bottom navigation height as well.
Is there any way to check that one?
filled navigation
transparent navigation
on same device
So i have an app in compose that has startDestination set as a screen with scaffold with bottom nav bar having 3 items and top app bar, i am able to navigate through the 3 bottom navigation tabs. But suppose i want to click on a card in one of the bottom tab screen which should open a details screen without the bottom bar and app bar (Since Navhost is inside the scaffold, bottom and top bars show up on details screen too), what is the right way to do that? Currently i have tried the following ways:-
1. Starting the details screen in a new activity.
2. Using currentDestination route as state to conditionally hide bottom and app bar for details screen route.
Both work but, the problem with first approach is that, it isn't recommended to use multiple activity with jetpack navigation and rather we should stick to a single activity, it also further breaks the navigation if in case i want to move from details to another screen. The problem with second approach is that hiding and showing bottom/top bars create very bad transition between the screens and app doesn't feel smooth.
Hence, i am looking for an appropriate way to handle this as per the guidelines, although i couldn't find any info on this.
Update
I went with showing/hiding the bottom and app bar based on routes, turns out that bad and laggy animation i was facing was because i was running a debug app, with a release app with minifyEnabled true (R8) ,the transitions are very smooth and natural, as i wanted them.
Also it turns out, as per Google's official compose sample app JetSnack , this is the appropriate way of achieving navigation from a bottombar screen to a non-bottombar screen. Thanks to #vitidev for pointing it out in the comments.
You can use a nested Navigation Graph:
one principal graph according to your BottomBar
one nested graph inside each screen you want to go further
https://developer.android.com/jetpack/compose/navigation#nested-nav
I have a TabbedPage with four tabs in Xamarin.Forms. The four tab pages each inherit from a common ContentPage with an AbsoluteLayout. When I push to this TabbedPage on Android, the new navigation bar momentarily appears about one-third of the way down the screen then rapidly animates to its proper position at the top of the screen, before other screen elements are displayed. It's very distracting, and even happens (without any text) if I do not set a title at all. Does not happen on iPhone.
How can I prevent this animation?
Edit: Here is a video showing the problem at 0:02, 0:24 and 0:40 : https://drive.google.com/drive/folders/1rHxS_rcVEr8sPC0yujcZf34XvLJ7yJ2K?usp=sharing
Well, the navbar animates from bottom to top of the screen and it stopped midway because I was doing too much on the UI thread in OnAppearing.
Adding a 200ms delay in OnAppearing was one way to avoid it.
I am implementing the Bottom App Bar (https://material.io/develop/android/components/bottom-app-bar/) and I am facing two challenges.
When using the Navigation component and navigate to a new fragment, the drawer icon turns int <- back button but it is black. Any way to change its color?
If I set the behavior to
myAppBar.hideOnScroll = true
then when I am in a Recyclerview and I scroll up, the bar gets hidden which is really nice. However, if I navigate to a new fragment, the bar remains hidden. How can I programatically show the bar again?
LE: 1. was fixed by using android:theme ThemeOverlay.MaterialComponents.Dark.ActionBar
Edit: The BottomAppBar can now be scrolled on or off the screen programatically. See https://issuetracker.google.com/issues/111925683
For now you could just set or animate the translationY property of the BottomAppBar to be 0. And perform the animations run by the BottomAppBar.Behavior on the fab: https://github.com/material-components/material-components-android/blob/841ba156fc33e721b991684c8a4bb4afdc56d90c/lib/java/com/google/android/material/bottomappbar/BottomAppBar.java#L754-L782