android - 此 XML 中的错误 : Error parsing XML: unbound prefix

标签 android android-xml

我有一个 Error parsing XML: unbound prefix在这个 xml 文件中:

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout>
    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/sipLabel"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"/>
    <ImageView android:src="@drawable/connected" android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:layout_weight="0.35" android:gravity="center"/>
</LinearLayout>

错误在<ImageView> . 可能是什么问题?

非常感谢。

最佳答案

您必须将命名空间声明 xmlns:android="http://schemas.android.com/apk/res/android" 放在布局 xml 的根元素中:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" [...]

关于android - 此 XML 中的错误 : Error parsing XML: unbound prefix,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5842237/

相关文章:

java - 可以在具有相同sharedUserId的应用程序之间共享strings.xml吗?

android - RxJava Single and Room 错误处理问题

android - 移动应用程序使用哪些标准通信协议(protocol)?

android - 在 android 中运行线程时显示和关闭进度对话框

java - scaleType和wrap_content如何确定ImageView的宽度和高度?

android - 如何在 XML 中的 TabLayout 上设置 onTabChanged 以调用 viewModel 方法?

android - Arcgis Map 的 toScreenPoint Api 返回 null

java - 如何在 Xamarin 中获取 AccessibilityManager 实例

android - 在启动画面中心裁剪背景图像

java - 操作栏布局看起来不正确