• 카테고리

    질문 & 답변
  • 세부 분야

    모바일 앱 개발

  • 해결 여부

    미해결

에러

21.12.01 14:02 작성 조회수 95

0

Unable to start activity ComponentInfo{com.cartris.a1201_draw_layout/com.cartris.a1201_draw_layout.DrawLayoutActivity}: android.view.InflateException: Binary XML file line #15 in com.cartris.a1201_draw_layout:layout/activity_draw_layout: Binary XML file line #19 in com.cartris.a1201_draw_layout:layout/content_draw_layout: Error inflating class fragment

이런 에러가 뜹니다 왜 그런걸까요??


activity_draw_layout 에 있는 코드 내용은 아래와 같습니다
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout 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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">

<include
android:id="@+id/app_bar_draw_layout"
layout="@layout/app_bar_draw_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_draw_layout"
app:menu="@menu/activity_draw_layout_drawer" />
</androidx.drawerlayout.widget.DrawerLayout>

content_draw_layout 에 있는 코드 내용은 아래와 같습니다

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/app_bar_draw_layout">

<fragment
android:id="@+id/nav_host_fragment_content_draw_layout"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/mobile_navigation" />
</androidx.constraintlayout.widget.ConstraintLayout>
 

답변 1

답변을 작성해보세요.

0

이수진님의 프로필

이수진

질문자

2021.12.01

1번 에러를 보고 content_draw_layout에서 <fragment <androidx.fragment.app.FragmentContainerView로 변경했는데 그 이후에 

1번 에러를 보고 content_draw_layout에서 <fragment <androidx.fragment.app.FragmentContainerView로 변경했는데 그 이후에 does not have a NavController set on 2131231021

 

이런 에러가 또 납니다..