【问题标题】:Unexpected namespace prefix "xmlns" found for Linear Layout [duplicate]为线性布局找到了意外的命名空间前缀“xmlns”[重复]
【发布时间】:2014-02-16 09:43:13
【问题描述】:

我在为 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>

【问题讨论】:

标签: java android xml android-linearlayout xml-namespaces


【解决方案1】:

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

【讨论】:

    【解决方案2】:

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

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

    (好吧,你必须保留&gt;

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

    【讨论】:

    • thanx mate 效果很好 :)
    猜你喜欢
    • 2013-02-01
    • 2013-06-01
    • 2014-04-05
    • 2013-05-28
    • 2013-07-04
    • 2013-05-03
    • 2013-09-11
    • 2013-05-06
    • 2016-04-05
    相关资源
    最近更新 更多