android - xml 文件中的错误

标签 android android-layout

我有以下 xml 文件:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/Scroll"
    android:layout_width="match_parent">
   <RelativeLayout 
    android:id="@+id/contenedor"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout android:id="@+id/cabecera"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="vertical"
        android:background="#CCCCFF"
        >

        <ImageView 
            android:id="@+id/icon"
            android:src="@drawable/guliver"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
        />

    </LinearLayout>

    <EditText android:id="@+id/edit_titulo_lugar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="100dp"
        android:layout_marginLeft="50dp"
        android:width="200dp" 
        android:hint="@string/titulo_lugar"
        android:inputType="text"
        />

    <EditText android:id="@+id/edit_descripcion_lugar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="170dp"
        android:layout_marginLeft="50dp"
        android:width="200dp" 
        android:hint="@string/descripcion_lugar"
        android:inputType="text"
        />

    <ImageButton
            android:id="@+id/imgButton"
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content"
            android:layout_marginTop="260dp"
            android:src="@drawable/camara1"
        />

        <Button android:id="@+id/guardar"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/textedit"
            android:text="@string/bguardar"
            android:layout_marginTop="310dp"
            android:layout_marginLeft="50dp"
            />

        <Button android:id="@+id/cancelar"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/textedit"
            android:text="@string/bcancelar"
            android:layout_marginTop="310dp"
            android:layout_marginLeft="200dp"
            />

   </RelativeLayout>
</ScrollView>

当我尝试运行该应用程序时出现错误: 解析 XML 时出错:ScrollView 标记中的未绑定(bind)前缀。

在网上搜索后,我找到了这个问题的几个答案,但我无法解决。 我也输入了

<?xml version="1.0" encoding="utf-8"?>

在 ScrollView 标记上方,但错误仍然存​​在。我还删除了 xmlns 字符串,但这不是解决方案。

怎么了?

谢谢。

最佳答案

您还没有在 ScrollView 元素中指定属性 android:layout_height:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/Scroll"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

</ScrollView>

关于android - xml 文件中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17897759/

相关文章:

Android:带 USB-C 适配器的耳机按钮

android - 如何将我的 Android 手机连接到 unity 以测试游戏?

android - 在android应用程序中显示树结构(父子节点)

android - 网站上的背景音频自动在笔记本电脑上运行,但在移动设备上不运行

android - 如何获取刚从相机捕获的图像路径

android - 无法正确约束文本

Android ViewAnimator/ViewFlipper/ViewSwitcher 和 setDisplayedChild 的硬编码值

android-为 Chip 文本添加顶部填充

android - Android 4.3 上的 "requestLayout() improperly called by..."错误

android - 在 Android 4.0+ 上删除操作栏左侧图标周围的填充