Android
Navigation Component 에서 그래프 여러개 관리하기
최데브
2022. 12. 11. 22:56
하나의 Graph 에서 모든 화면을 관리하면 너무 어지럽고 복잡하다.
그래서 지금 하는 프로젝트에서는 화면별로 그래프를 분리해서 사용하는데
<?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/nav_graph"
app:startDestination="@id/Mainfragment">
<fragment
android:id="@+id/Mainfragment"
tools:layout="@layout/fragment_main"
android:name="com.dev6.rejord.MainFragment">
<action
android:id="@+id/action_random_fragment_to_settings_nav_graph"
app:destination="@id/join_graph" />
</fragment>
<include app:graph="@navigation/join_graph" />
</navigation>
간단하게 inclue 를 적어서 써주자