I know with Navigation Component, you can easily set up your toolbar to work with it (https://developer.android.com/guide/navigation/navigation-ui#create_a_toolbar).
You call setupWithNavController and it all magically happens. Then, you get a back arrow whenever you aren't at the start destination.
I am currently working with Jetpack Compose and I'm still new to it. I'm trying to see if navigation component is able to do something similar with the TopAppBar in a Scaffold.
Is there an easy way to set up the nav component with the TopAppBar, or do my navigation icons (back arrows) need to be done manually (call navController.popBackStack as the onClick for these icons)?
In compose, as of compose 1.0.1, at least, you must manually implement it. For a complete understanding, check out this codelab. People are trying to make coding as easy as possible. If it could be automatically done, what you're asking for, it would have been the recommended way in the official codelab, but it isn't. You can file a feature request though.
Related
Android usually supports navigation with the tab and enter key as described here.
However, when using Jetpack compose this option seems unavailable. Is this true and if yes I wonder what would be the simplest method to navigate a Jetpack Compose Kotlin App using my keyboard?
maybe use the custom navigation as described here ?
or better implement a whole new navigation method as described here?
Thank you for any help
What exactly is the difference between a ModalDrawer() and Scaffold(DrawerContent)? I seem to recall reading somewhere that the ModalDrawer() incorporates the navigation component. I also think I read that you can't use a ModalDrawer with Scaffold, or that they don't work well together.
When do you want to use one over the other?
I went through many questions regarding making bottom bar but my my question is a bit different.I want to make this.
bottom menu:
Now the thing is, the menu is not static.It's items can vary depending upon user's choice.So, I have to make it dynamic. What's the best approach to achieve this?
Also, I'm not sure how do I make that curved outline at the center item.I'm thinking that I should do it programmatically.Any suggestions are welcome.Even better if you can share code.
Use this to create Navigation bar, it will surly create view that you show us in image.
https://github.com/armcha/Space-Navigation-View
Bottom menu is now an official navigation view according to the official documentation but as far as I know, there is no native component available yet to implement that.
In my opinion, your best bet is to try customizing the following library created by Iiro Krankka (http://github.com/roughike):
BottomBar
Over the past few days I've started to work with the Master/Detail template in Eclipse and I've been trying to figure out a way to take the generated Master/Detail template and convert it to have a navigation drawer-type UI. I imagine that it's possible to do, but how can I go about doing? What do I need to add/remove/modify in order to get similar/identical functionality to a navigation drawer using Master/Detail? I'm asking for assistance creating it using Master/Detail because I have tried other methods with no luck whatsoever. Also, how can I customize the look of it (background color, text color, etc.)?
Thank you in advance for any help in solving this! I have searched relentlessly for a solution with no results unfortunately so I hope that someone in the SO community can assist.
Given that the Navigation Drawer is not appropriate for displaying Master/Detail data (i.e., it is only for navigation, not showing content), then you use the same steps as converting any Activity to using a Navigation Drawer. The Android training Creating a Navigation Drawer goes into extensive detail with all the code you'd need to add a Navigation Drawer to an Activity and properly implement the Navigation Drawer design pattern.
It may make sense to start with a simple Activity, then use what you learn there to apply it to the Master/Detail template.
I want to use sliding drawer from left to right ?
So can you tell me anybody how it is possible? and also use this drawer to all activity in my project.
Use the concept of viewpager.You can find doc and example below...
doc
Example
Check that library. API 6+ (even less, not quite sure)
https://github.com/6wunderkinder/android-sliding-layer-lib
You can attach a layer to any part of the screen with the addition that you can swipe the layout directly in and out, unlike the SlidingDrawer in which you just can drag from a small piece of UI (drawer).
You could also use the new NavigationDrawer pattern from Google.
http://developer.android.com/design/patterns/navigation-drawer.html