意外的命名空间preFIX"的xmlns"发现标签的LinearLayout [英] Unexpected namespace prefix "xmlns" found for tag LinearLayout

查看:173
本文介绍了意外的命名空间preFIX"的xmlns"发现标签的LinearLayout的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有在下面的XML文件中的错误。 意外的命名空间preFIX的xmlns找到标签的LinearLayout的。我试过其他类似的问题也提供了解决方案,但它并没有为我工作。同样的错误发生在3行,其中的LinearLayout 被使用。

 < XML版本=1.0编码=UTF-8&GT?;
<滚动型的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT
    机器人:背景=@可绘制/背景>

    <的LinearLayout
        的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =FILL_PARENT
        机器人:方向=垂直>

        <的TextView
            机器人:ID =@ + ID / menu_top_text
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:文本=@字符串/ name_version
            机器人:文字颜色=@彩色/黑白
            机器人:TEXTSIZE =20SP/>

        <的LinearLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =WRAP_CONTENT
            机器人:方向=横向>
        < / LinearLayout中>

        <! - 水平线 - >

        <的FrameLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =30像素>
        < /的FrameLayout>

        <的LinearLayout
            的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =WRAP_CONTENT
            机器人:重力=center_horizo​​ntal
            机器人:方向=垂直>

            <的LinearLayout
                的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =WRAP_CONTENT
                机器人:重力=中心
                机器人:方向=横向>

                <按钮
                    机器人:ID =@ + ID / start_stop_button
                    机器人:layout_width =74dp
                    机器人:layout_height =74dp
                    机器人:文本=@字符串/ START_SERVER/>

                <按钮
                    机器人:ID =@ + ID /指令
                    机器人:layout_width =120dp
                    机器人:layout_height =74dp
                    机器人:文本=@字符串/ instructions_label/>

                <按钮
                    机器人:ID =@ + ID /设置
                    机器人:layout_width =74dp
                    机器人:layout_height =74dp
                    机器人:文本=@字符串/ setup_label/>
            < / LinearLayout中>
        < / LinearLayout中>

        <的FrameLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =30像素>
        < /的FrameLayout>

        <! - 水平线 - >

        <的FrameLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =1像素
            机器人:后台=#666666>
        < /的FrameLayout>

        <的FrameLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =10px的>
        < /的FrameLayout>

        < TableLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =WRAP_CONTENT
            机器人:shrinkColumns =2>

            <的TableRow>

                <的TextView
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:重力=左
                    机器人:文本=@字符串/ server_status
                    机器人:文字颜色=@彩色/黑白
                    机器人:TEXTSIZE =16SP/>
                <! - 列之间的一个小垫片 - >

                <的FrameLayout
                    机器人:layout_width =3SP
                    机器人:layout_height =WRAP_CONTENT/>

                <的TextView
                    机器人:ID =@ + ID / server_status
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:文本=@字符串/未知
                    机器人:文字颜色=@彩色/黑白
                    机器人:TEXTSIZE =16SP/>
            < /的TableRow>
        < / TableLayout>

        <的FrameLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =10px的>
        < /的FrameLayout>

        <! - 水平线 - >

        <的FrameLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =1像素
            机器人:后台=#666666>
        < /的FrameLayout>

        <的FrameLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =10px的>
        < /的FrameLayout>

        < TableLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =WRAP_CONTENT
            机器人:shrinkColumns =2>

            <的TableRow>

                <的TextView
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:重力=左
                    机器人:文本=@字符串/ my_url_is
                    机器人:文字颜色=@彩色/黑白
                    机器人:TEXTSIZE =16SP/>
                <! - 列之间的一个小垫片 - >

                <的FrameLayout
                    机器人:layout_width =3SP
                    机器人:layout_height =WRAP_CONTENT/>

                <的TextView
                    机器人:ID =@ + ID / IP_ADDRESS
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:文本=@字符串/ no_url_yet
                    机器人:文字颜色=@彩色/黑白
                    机器人:TEXTSIZE =16SP/>
            < /的TableRow>

            <的TableRow>

                <的TextView
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:重力=左
                    机器人:文本=@字符串/ wifi_status
                    机器人:文字颜色=@彩色/黑白
                    机器人:TEXTSIZE =16SP/>
                <! - 列之间的一个小垫片 - >

                <的FrameLayout
                    机器人:layout_width =3SP
                    机器人:layout_height =WRAP_CONTENT/>

                <的TextView
                    机器人:ID =@ + ID / wifi_status
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:文本=@字符串/未知
                    机器人:文字颜色=@彩色/黑白
                    机器人:TEXTSIZE =16SP/>
            < /的TableRow>

            <的TableRow>

                <的TextView
                    机器人:ID =@ + ID / last_error_label
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:重力=左
                    机器人:文本=@字符串/ last_error
                    机器人:TEXTSIZE =16SP
                    机器人:能见度=水涨船高/>
                <! - 列之间的一个小垫片 - >

                <的FrameLayout
                    机器人:layout_width =3SP
                    机器人:layout_height =WRAP_CONTENT/>

                <的TextView
                    机器人:ID =@ + ID / last_error
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:文本=@字符串/未知
                    机器人:文字颜色=#FF0000
                    机器人:TEXTSIZE =16SP
                    机器人:能见度=水涨船高/>
            < /的TableRow>
        < / TableLayout>

        <的FrameLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =10px的>
        < /的FrameLayout>

        <! - 水平线 - >

        <的FrameLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =1像素
            机器人:后台=#666666>
        < /的FrameLayout>

        <! - 
          < TextView的机器人:ID =@ + ID / proxy_header
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_width =WRAP_CONTENT
        机器人:文本=@字符串/ proxy_experimental
        机器人:TEXTSIZE =16SP
        />
         - >

        < TableLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =WRAP_CONTENT
            机器人:shrinkColumns =2>

            <的TableRow>

                <! - 
                 <的TextView
                机器人:layout_height =WRAP_CONTENT
                机器人:layout_width =WRAP_CONTENT
                机器人:文本=@字符串/ proxy_status
                机器人:TEXTSIZE =16SP
                机器人:重力=左
                />
                 - >
                <! - 列之间的一个小垫片 - >

                <的FrameLayout
                    机器人:layout_width =3SP
                    机器人:layout_height =WRAP_CONTENT/>
            < /的TableRow>

            <的TableRow>

                <! - 列之间的一个小垫片 - >

                <的FrameLayout
                    机器人:layout_width =3SP
                    机器人:layout_height =WRAP_CONTENT/>
            < /的TableRow>

            <的TableRow>

                <! - 列之间的一个小垫片 - >

                <的FrameLayout
                    机器人:layout_width =3SP
                    机器人:layout_height =WRAP_CONTENT/>
            < /的TableRow>

            <的TableRow>

                <! - 列之间的一个小垫片 - >

                <的FrameLayout
                    机器人:layout_width =3SP
                    机器人:layout_height =WRAP_CONTENT/>
            < /的TableRow>
        < / TableLayout>

        <! - 水平线 - >

        <的FrameLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =1DP
            机器人:后台=#666666>
        < /的FrameLayout>

        <! - 水平线 - >

        <的FrameLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =1DP
            机器人:后台=#666666>
        < /的FrameLayout>

        <的LinearLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =WRAP_CONTENT
            机器人:方向=横向
            机器人:能见度=水涨船高>

            <的TextView
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:文本=@字符串/ server_log
                机器人:文字颜色=#FFFFFF/>

            <复选框
                机器人:ID =@ + ID / server_log_checkbox
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:检查=FALSE/>
        < / LinearLayout中>

        <的TextView
            机器人:ID =@ + ID / server_log
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =WRAP_CONTENT
            机器人:后台=#333333/>

        <! - 水平线 - >

        <的FrameLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =1DP
            机器人:后台=#666666
            机器人:能见度=水涨船高>
        < /的FrameLayout>

        <的LinearLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =WRAP_CONTENT
            机器人:方向=横向
            机器人:能见度=水涨船高>

            <的TextView
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:文本=@字符串/ session_monitor
                机器人:文字颜色=#FFFFFF
                机器人:能见度=水涨船高/>

            <复选框
                机器人:ID =@ + ID / session_monitor_checkbox
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:检查=假
                机器人:能见度=水涨船高/>
        < / LinearLayout中>

        <的TextView
            机器人:ID =@ + ID / session_monitor
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =WRAP_CONTENT
            机器人:后台=#333333
            机器人:能见度=水涨船高/>

        <! - 水平线 - >

        <的FrameLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =1DP
            机器人:后台=#666666>
        < /的FrameLayout>

        <! - 这是赏心悦目有在底部的一些空白 - >

        <的FrameLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =15dp/>
    < / LinearLayout中>

< /滚动型>
 

解决方案

请尝试以下操作:

删除的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android 所有不含地方滚动型。我相信这是足够的它通知给应用程序一次,并在最外层的布局或查看XML文件。

I am having an error in following xml file. "Unexpected namespace prefix "xmlns" found for tag LinearLayout". I tried the solutions provided in other similar questions also but it didn't work for me. Same error is occurring in 3 lines where LinearLayout is used.

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/background" >

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/menu_top_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/name_version"
            android:textColor="@color/black"
            android:textSize="20sp" />

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >
        </LinearLayout>

        <!-- A horizontal line -->

        <FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="30px" >
        </FrameLayout>

        <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:orientation="vertical" >

            <LinearLayout
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:orientation="horizontal" >

                <Button
                    android:id="@+id/start_stop_button"
                    android:layout_width="74dp"
                    android:layout_height="74dp"
                    android:text="@string/start_server" />

                <Button
                    android:id="@+id/instructions"
                    android:layout_width="120dp"
                    android:layout_height="74dp"
                    android:text="@string/instructions_label" />

                <Button
                    android:id="@+id/setup"
                    android:layout_width="74dp"
                    android:layout_height="74dp"
                    android:text="@string/setup_label" />
            </LinearLayout>
        </LinearLayout>

        <FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="30px" >
        </FrameLayout>

        <!-- A horizontal line -->

        <FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="1px"
            android:background="#666666" >
        </FrameLayout>

        <FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="10px" >
        </FrameLayout>

        <TableLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:shrinkColumns="2" >

            <TableRow>

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:gravity="left"
                    android:text="@string/server_status"
                    android:textColor="@color/black"
                    android:textSize="16sp" />
                <!-- A small spacer between the columns -->

                <FrameLayout
                    android:layout_width="3sp"
                    android:layout_height="wrap_content" />

                <TextView
                    android:id="@+id/server_status"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/unknown"
                    android:textColor="@color/black"
                    android:textSize="16sp" />
            </TableRow>
        </TableLayout>

        <FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="10px" >
        </FrameLayout>

        <!-- A horizontal line -->

        <FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="1px"
            android:background="#666666" >
        </FrameLayout>

        <FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="10px" >
        </FrameLayout>

        <TableLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:shrinkColumns="2" >

            <TableRow>

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:gravity="left"
                    android:text="@string/my_url_is"
                    android:textColor="@color/black"
                    android:textSize="16sp" />
                <!-- A small spacer between the columns -->

                <FrameLayout
                    android:layout_width="3sp"
                    android:layout_height="wrap_content" />

                <TextView
                    android:id="@+id/ip_address"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/no_url_yet"
                    android:textColor="@color/black"
                    android:textSize="16sp" />
            </TableRow>

            <TableRow>

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:gravity="left"
                    android:text="@string/wifi_status"
                    android:textColor="@color/black"
                    android:textSize="16sp" />
                <!-- A small spacer between the columns -->

                <FrameLayout
                    android:layout_width="3sp"
                    android:layout_height="wrap_content" />

                <TextView
                    android:id="@+id/wifi_status"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/unknown"
                    android:textColor="@color/black"
                    android:textSize="16sp" />
            </TableRow>

            <TableRow>

                <TextView
                    android:id="@+id/last_error_label"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:gravity="left"
                    android:text="@string/last_error"
                    android:textSize="16sp"
                    android:visibility="gone" />
                <!-- A small spacer between the columns -->

                <FrameLayout
                    android:layout_width="3sp"
                    android:layout_height="wrap_content" />

                <TextView
                    android:id="@+id/last_error"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/unknown"
                    android:textColor="#ff0000"
                    android:textSize="16sp"
                    android:visibility="gone" />
            </TableRow>
        </TableLayout>

        <FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="10px" >
        </FrameLayout>

        <!-- A horizontal line -->

        <FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="1px"
            android:background="#666666" >
        </FrameLayout>

        <!--
          <TextView android:id="@+id/proxy_header"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:text="@string/proxy_experimental"
        android:textSize="16sp"
        />
        -->

        <TableLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:shrinkColumns="2" >

            <TableRow>

                <!--
                 <TextView
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:text="@string/proxy_status"
                android:textSize="16sp"
                android:gravity="left"
                />
                -->
                <!-- A small spacer between the columns -->

                <FrameLayout
                    android:layout_width="3sp"
                    android:layout_height="wrap_content" />
            </TableRow>

            <TableRow>

                <!-- A small spacer between the columns -->

                <FrameLayout
                    android:layout_width="3sp"
                    android:layout_height="wrap_content" />
            </TableRow>

            <TableRow>

                <!-- A small spacer between the columns -->

                <FrameLayout
                    android:layout_width="3sp"
                    android:layout_height="wrap_content" />
            </TableRow>

            <TableRow>

                <!-- A small spacer between the columns -->

                <FrameLayout
                    android:layout_width="3sp"
                    android:layout_height="wrap_content" />
            </TableRow>
        </TableLayout>

        <!-- A horizontal line -->

        <FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="1dp"
            android:background="#666666" >
        </FrameLayout>

        <!-- A horizontal line -->

        <FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="1dp"
            android:background="#666666" >
        </FrameLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:visibility="gone" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/server_log"
                android:textColor="#ffffff" />

            <CheckBox
                android:id="@+id/server_log_checkbox"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:checked="false" />
        </LinearLayout>

        <TextView
            android:id="@+id/server_log"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="#333333" />

        <!-- A horizontal line -->

        <FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="1dp"
            android:background="#666666"
            android:visibility="gone" >
        </FrameLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:visibility="gone" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/session_monitor"
                android:textColor="#ffffff"
                android:visibility="gone" />

            <CheckBox
                android:id="@+id/session_monitor_checkbox"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:checked="false"
                android:visibility="gone" />
        </LinearLayout>

        <TextView
            android:id="@+id/session_monitor"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="#333333"
            android:visibility="gone" />

        <!-- A horizontal line -->

        <FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="1dp"
            android:background="#666666" >
        </FrameLayout>

        <!-- It's visually pleasing to have some empty space at the bottom -->

        <FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="15dp" />
    </LinearLayout>

</ScrollView>

解决方案

Please try following:

Remove xmlns:android="http://schemas.android.com/apk/res/android from all the places excluding the ScrollView. I believe it is sufficient to inform it to the application once and in the outermost Layout or View of the xml file.

这篇关于意外的命名空间preFIX&QUOT;的xmlns&QUOT;发现标签的LinearLayout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆