¿Como puedo agregar mi Navigator personalizado a mi NavController?

问题描述 投票:0回答:1
<<

Caused by: java.lang.IllegalStateException: Could not find Navigator with name "sticky_fragment". You must call NavController.addNavigator() for each navigation type.

具有必需的setContentView,导航器导航NavController.addNavigator(),导航器和导航器等。 

En archivo mobile_navigation.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/mobile_navigation" app:startDestination="@+id/nav_inicio"> <sticky_fragment android:id="@+id/nav_inicio" android:name="jacea.servicios.app.ui.inicio.PublicacionesFragment" android:label="@string/menu_inicio" tools:layout="@layout/fragment_inicio" /> <sticky_fragment android:id="@+id/nav_pedidos" android:name="jacea.servicios.app.ui.pedidos.PedidosFragment" android:label="@string/menu_pedidos" tools:layout="@layout/fragment_pedidos" /> <sticky_fragment android:id="@+id/nav_cuenta_usuario" android:name="jacea.servicios.app.ui.cuenta_usuario.CuentaUsuarioFragment" android:label="@string/cuenta_usuario" tools:layout="@layout/fragment_cuenta_usuario" /> <sticky_fragment android:id="@+id/nav_crear_publicacion" android:name="jacea.servicios.app.ui.crear_publicacion.CrearPublicacionFragment" android:label="@string/crear_publicacion" tools:layout="@layout/fragment_crear_publicacion" /> <action android:id="@+id/action_global_nav_inicio" app:destination="@id/nav_inicio" app:popUpTo="@id/nav_inicio" app:launchSingleTop="true" /> <action android:id="@+id/action_global_nav_crear_publicacion" app:destination="@id/nav_crear_publicacion" app:popUpTo="@id/nav_crear_publicacion" app:launchSingleTop="true" /> <action android:id="@+id/action_global_nav_pedidos" app:destination="@id/nav_pedidos" app:popUpTo="@id/nav_pedidos" app:launchSingleTop="true" /> <action android:id="@+id/action_global_nav_cuenta_usuario" app:destination="@id/nav_cuenta_usuario" app:popUpTo="@id/nav_cuenta_usuario" app:launchSingleTop="true" /> </navigation>

<<
https://github.com/STAR-ZERO/navigation-keep-fragment-sample/issues/4Esto resolvio el problema
android navigation-drawer
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.