我必须盯着这个问题并且看不到它,因此我们将为您提供帮助。

我的XML中有一个按钮声明:

<Button xmlns:android="http//schemas.android.com/apk/res/android"
        android:layout_width="25dp"
        android:layout_height="25dp"
        android:background="@drawable/key_bg"
        android:text="Q" />


XML膨胀时,出现上述错误,应用崩溃。

我肯定知道是引起此问题的按钮,因为(1)错误中指示的行号恰好是声明此按钮的行; (2)我在XML中有几个这样的东西,如果我注释掉它,我将得到相同的错误,行号指向具有相同声明的下一个按钮。

据我所知,layout_widthlayout_height在那里,那么它在抱怨什么呢?

提前致谢!

最佳答案

您在xmlns:android =“ http // ....”中丢失了“:”,请尝试

<Button xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="25dp"
    android:layout_height="25dp"
    android:background="@drawable/key_bg"
    android:text="Q" />

10-07 19:35
查看更多