Java 意外的命名空间前缀";xmlns";为线性布局找到

Java 意外的命名空间前缀";xmlns";为线性布局找到,java,android,xml,android-linearlayout,xml-namespaces,Java,Android,Xml,Android Linearlayout,Xml Namespaces,我在android应用程序中为customdialog创建.xml文件时遇到此错误 为标记线性布局找到意外的命名空间前缀“xmlns” 这是我的密码: <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:layout_gravity="center" android:orientation="vertical" android:layout_width="wrap_content" android:l

我在android应用程序中为customdialog创建.xml文件时遇到此错误

为标记线性布局找到意外的命名空间前缀“xmlns”

这是我的密码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
android:layout_gravity="center" 
android:orientation="vertical" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content"

xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView 
    ...
<ScrollView 
    ...
<LinearLayout 
    ...

  **xmlns:android="http://schemas.android.com/apk/res/android">**
    <Button 
        ...
    <Button 
        ...
    <Button 
        ...
  </LinearLayout>
</LinearLayout>


在XML中,您已经进入了第一个
xmlns:android
定义的范围。你不应该再定义它了。只需删除第二个定义,您就可以了。

只需删除您已经用星号标记的行:

**xmlns:android="http://schemas.android.com/apk/res/android">**
(好吧,您必须保留


xmlns标签应该只包含在最外面的容器中。

您是否尝试过删除xmlns:android=“”>您已经在StartHanx mate中提供了它(很好:)