Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/182.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android.view.inflate异常,二进制xml文件行#28错误膨胀类com.xyz.featureTop_Android_Xml_Android Layout_Android Inflate - Fatal编程技术网

android.view.inflate异常,二进制xml文件行#28错误膨胀类com.xyz.featureTop

android.view.inflate异常,二进制xml文件行#28错误膨胀类com.xyz.featureTop,android,xml,android-layout,android-inflate,Android,Xml,Android Layout,Android Inflate,将布局加载到“活动”时出现上述错误。请查看下面的代码 我的xml布局文件- <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:weightSum="1" > <com.xyz.FeatureTop xmlns:andro

将布局加载到“活动”时出现上述错误。请查看下面的代码 我的xml布局文件-

 <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:weightSum="1" >

    <com.xyz.FeatureTop
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight=".35" >

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@android:color/white"
            android:gravity="center"
            android:text="Hello Feature Top"
            android:textColor="@android:color/black" />
    </com.xyz.FeatureTop>

    <com.xyz.Middle
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight=".35" >

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@android:color/white"
            android:gravity="center"
            android:text="Hello Feature Middle"
            android:textColor="@android:color/black" />
    </com.xyz.Middle>

    <com.xyz.FeatureBottom
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight=".3" >

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@android:color/white"
            android:gravity="center"
            android:text="Hello Feature Bottom"
            android:textColor="@android:color/black" />
    </com.xyz.FeatureBottom>
</LinearLayout>
} 我不知道这个错误。xml中是否缺少任何属性?我是android开发新手 提前谢谢。

代替

<com.xyz.Middle
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight=".35" >
{...}
</com.xyz.Middle>

com.xyz.FeatureBottom
等做同样的操作。

我观察到,如果我操作这个类,那么它的工作就很好。但是,如果它的内部类不工作,给我这个错误。我不知道为什么会这样。有人知道如何使用内部类吗?

我在这里找到了解决方案-

我把它放在类属性中-

 <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight=".35" 
        class = "com.xyz.FeatureTop">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@android:color/white"
            android:gravity="center"
            android:text="Hello Feature Top"
            android:textColor="@android:color/black" />
    </LinearLayout>


--在XML
com.xyz.xyz.Middle中显示堆栈跟踪和显示行#28
->您的包、点、类、点、内部类?堆栈跟踪-11-28 16:28:42.604:E/AndroidRuntime(6324):java.lang.RuntimeException:无法启动activity ComponentInfo:android.view.InflateException:二进制XML文件行#28:膨胀类com.xyz.FeatureTop时出错,第28行是在放入$sign后,它将删除内部类并将xyz作为属性。我也犯了同样的错误。
<com.xyz.Xyz$Middle
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight=".35" >
{...}
</com.xyz.Middle>
 <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight=".35" 
        class = "com.xyz.FeatureTop">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@android:color/white"
            android:gravity="center"
            android:text="Hello Feature Top"
            android:textColor="@android:color/black" />
    </LinearLayout>