khu*_*dey 51 xml eclipse android android-xml
我在跟踪xml文件时出错."为标记LinearLayout找到"意外的名称空间前缀"xmlns".我尝试了其他类似问题中提供的解决方案,但它对我不起作用.在使用的3行中发生相同的错误LinearLayout.
<?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>
Run Code Online (Sandbox Code Playgroud)
Sho*_*uri 83
请尝试以下方法:
xmlns:android="http://schemas.android.com/apk/res/android从除了的所有地方删除ScrollView.我相信只需一次通知应用程序就可以在xml文件的最外层布局或视图中通知它.
Sud*_*hir 43
我用各种代码多次遇到这个问题.
代码在过去运行得非常好,但现在他们正在显示这些错误....
我发现了一个非常简单的解决方案,不需要任何代码更改(添加,编辑或删除).
转到选项卡上的项目选项卡单击选项卡从列表中选择"清除...."
您将看到工作区中打开的所有项目的列表.
您可以选择一个项目或全部(我通常做"清理所有项目").单击确定.对于大约10个项目,该过程大约需要5-7秒.所有的XMLNS错误都得到了解决......你应该在尝试任何其他解决方案之前尝试这个....这就像重新启动系统的Window错误一样,70%的时间解决了问题...
上面的解决方案更多的是在所有情况下工作的临时解决方案.为了避免将来的情况,我所有的xmlns代码都在顶部.(可能需要删除重复的声明)
将Admob集成到XML文件时,我遇到了这个问题.
在Android xml文件中,Android命名空间可以:
View在xml层次结构中的top('outer')Android 中声明或者在构建项目时会收到错误.在您的情况下,顶级Android视图是ScrollView,所以保持
xmlns:android="http://schemas.android.com/apk/res/android"
Run Code Online (Sandbox Code Playgroud)
在ScrollView,并从其他所有嵌套中删除它Views,包括LinearLayout.
| 归档时间: |
|
| 查看次数: |
64145 次 |
| 最近记录: |