Java 二进制XML文件行#29:二进制XML文件行#29:膨胀类片段时出错
我面临以下错误 致命异常:java.lang.RuntimeException:无法启动活动 ComponentInfo{com.test/com.activities.ViewActivity}: android.view.InflateException:二进制XML文件行#29:二进制XML 文件行#29:膨胀类片段时出错 在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2984)上 位于android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045) 位于android.app.ActivityThread.-wrap14(ActivityThread.java) 在android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642) 位于android.os.Handler.dispatchMessage(Handler.java:102) 位于android.os.Looper.loop(Looper.java:154) 位于android.app.ActivityThread.main(ActivityThread.java:6776) 位于java.lang.reflect.Method.invoke(Method.java) 在com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)上 位于com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410) XML文件Java 二进制XML文件行#29:二进制XML文件行#29:膨胀类片段时出错,java,android,xml,android-fragments,Java,Android,Xml,Android Fragments,我面临以下错误 致命异常:java.lang.RuntimeException:无法启动活动 ComponentInfo{com.test/com.activities.ViewActivity}: android.view.InflateException:二进制XML文件行#29:二进制XML 文件行#29:膨胀类片段时出错 在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2984)上 位于andro
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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"
android:fitsSystemWindows="true"
tools:context="com.activities.ViewActivity">
<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
>
<fragment class="com.fragments.ViewFragment"
android:id="@+id/details_frag"
tools:layout="@layout/fragment_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
</fragment>
</FrameLayout>
</android.support.design.widget.CoordinatorLayout>
stacktrace显示“错误膨胀类片段”,因此布局文件中的片段标记一定存在问题。XML应该如下所示:
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:name="com.fragments.ViewFragment"
android:id="@+id/details_frag"
tools:layout="@layout/fragment_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
</fragment>
并检查name
属性。验证片段是否存在于指定的包中,并且具有指定的确切名称
如果这不起作用,请发布完整的stacktrace,我将帮助解决问题
我希望它能对您有所帮助stacktrace显示“错误膨胀类片段”,因此布局文件中的片段标记一定有问题。XML应该如下所示:
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:name="com.fragments.ViewFragment"
android:id="@+id/details_frag"
tools:layout="@layout/fragment_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
</fragment>
并检查name
属性。验证片段是否存在于指定的包中,并且具有指定的确切名称
如果这不起作用,请发布完整的stacktrace,我将帮助解决问题
我希望它将对您有所帮助将FrameLayout用作碎片持有者,并使用活动中的碎片事务将碎片动态添加到此碎片持有者 根据build.gradle文件,删除内部的片段看起来有问题
请确保您根据自己的要求添加该片段,例如将其添加到Backback和all中。将FrameLayout用作碎片持有者,并使用活动中的碎片事务将碎片动态添加到此碎片持有者 根据build.gradle文件,删除内部的片段看起来有问题
请确保您根据自己的要求添加它,例如将其添加到Backback和all中。您也可以发布java代码
com.fragments.ViewFragment
是否存在此类?是,它在根异常的堆栈跟踪中进一步执行existLook。您是否也可以发布java代码com.fragments。ViewFragment
是否存在此类?是的,它在根异常的堆栈跟踪中进一步执行existLook。