【发布时间】:2022-01-17 15:00:45
【问题描述】:
启动应用程序时出现错误。我的代码没有错误,但我仍然收到此错误。帮我解决一下。
android.view.InflateException: Binary XML file line #15: Binary XML file line #19: Error inflating class fragment
<?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_main1">
<fragment
android:id="@+id/nav_host_fragment_content_main1"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true" <---- THIS IS 15
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/mobile_navigation" /> <----THIS IS 19
</androidx.constraintlayout.widget.ConstraintLayout>
【问题讨论】:
标签: runtime-error fragment inflate-exception