android-jetpack-navigation

Bottom Navigation View With Navigation Control transaction failing some times

耗尽温柔 提交于 2020-01-16 09:03:12
问题 while moving from one tab to another tab on bottom navigation view some times i am getting the app theme color is applying to enter fragment like this is my code ``code from activity``` override fun onSupportNavigateUp() = NavigationUI.navigateUp(navController!!, null) private fun setUpNavigation() { navController = Navigation.findNavController(this, R.id.frameRoot) bottomNavigationView.setupWithNavController(navController) bottomNavigationView.setOnNavigationItemSelectedListener { item ->

Display back button on toolbar on first screen of navigation graph

牧云@^-^@ 提交于 2020-01-12 09:50:47
问题 I'm trying out androidx navigation component and have setup my activity with a toolbar a container. I'm doing this in one of the intermittent screens of my app which has a lot of internal navigation/steps and I thought I could navigation arch component a try with this. Since this is an intermittent screen, I want to display a back button on the toolbar from the first screen itself. I've already setup the toolbar with the below code in the onCreate() method of my host activity,

Scoping a viewmodel to multiple fragments (not activity) using the navigation component

自古美人都是妖i 提交于 2020-01-09 11:15:50
问题 I'm using the navigation component, I want a view model to be shared between a few fragments but they should be cleared when I leave the fragments (hence not scoping them to the activity) I'm trying to take the one activity many fragments approach. I have managed to achieve this using multiple nav hosts and scoping the fragments to it using getParentFragment but this just leads to more issues having to wrap fragments in other parent fragments, losing the back button working seamlessly and

Hide Toolbar back arrow with NavigationComponent and BottomNavigationView

北城余情 提交于 2020-01-06 06:46:45
问题 I'm in the process of implementing NavigationComponent coupled with a BottomNavigationView and I am noticing that the back arrow is shown in the toolbar for all fragment destinations except the one specified as the startDestination in my navigation graph. All examples of this implementation that I've been able to find show similar behavior. Hiding the back arrow for each associated fragment of a BottomNavigationView seems like a more natural design in my opinion, (hitting a back arrow in the

Android Navcontroller hardware back button crash

ぃ、小莉子 提交于 2020-01-06 02:35:22
问题 I am using new android storyboard to create an application. The flow need to be like following: SplashFragment -> Fragment1 -> Fragment2 Following is the storyboard( navigation_main.xml ): <?xml version="1.0" encoding="utf-8"?> <navigation xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/launch_navigation_graph" app:startDestination="@id/splashFragment"> <fragment

Animation issues when using BottomNavigationView with NavController and each Fragment has its own Toolbar

本秂侑毒 提交于 2019-12-10 18:28:41
问题 The bounty expires in 12 hours . Answers to this question are eligible for a +100 reputation bounty. Josh Hardman wants to draw more attention to this question. I'm developing an app in Kotlin using some of the latest Android Jetepack components. I've recently had a bit of a hitch with the following case: This issue seems to occur when using BottomNavigationView with NavController , and when each Fragment has its own Toolbar . The problem is that when transitioning from Fragment A to Fragment

Navigation View Global Action Back State

六眼飞鱼酱① 提交于 2019-12-02 09:04:30
问题 I have been messing with the Jetpack Navigation component, and I created an activity that uses a navigation drawer. class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val navigationController = findNavController(R.id.navigationHostFragment) navigationView.setupWithNavController(navigationController) val appBarConfiguration = AppBarConfiguration(TOP_LEVEL_DESTINATIONS,

Navigation View Global Action Back State

久未见 提交于 2019-12-02 06:53:51
I have been messing with the Jetpack Navigation component, and I created an activity that uses a navigation drawer. class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val navigationController = findNavController(R.id.navigationHostFragment) navigationView.setupWithNavController(navigationController) val appBarConfiguration = AppBarConfiguration(TOP_LEVEL_DESTINATIONS, drawerLayout) toolbar.setupWithNavController(navigationController, appBarConfiguration) } override fun

Fragments destroyed / recreated with Jetpack's Android Navigation components

蹲街弑〆低调 提交于 2019-11-27 00:55:29
问题 I'm trying to implement Navigation with Jetpack's architecture components in my existing app. I have a single activity app where the main fragment ( ListFragment ) is a list of items. Currently, when the user taps on a list item a second fragment is added to the stack by fragmentTransaction.add(R.id.main, detailFragment) . So when back is pressed the DetailFragment is detached and the ListFragment is shown again. With Navigation architecture this is handled automatically. Instead of adding