XML格式不正确(令牌无效)

时间:2019-11-19 14:56:28

标签: xamarin.android

当我尝试使用xamarin for android构建我的应用程序时,弹出错误提示

  

解析XML时出错:第17行的格式不正确(无效的令牌)

我似乎找不到错误的结构。看起来,这与我尝试在网格布局中包括按钮的方式有关。我敢肯定这是愚蠢的,但我只是找不到。我在下面包含了我的代码:

新错误:

  

解析XML时出错:第17行的未绑定前缀

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

<GridLayout>
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:minWidth="25px"
    android:minHeight="25px"
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:id="@+id/gridLayout1"
    android:paddingLeft="40"
    android:alignmentMode="alignMargins"
    android:columnCount="3"
    android:rowCount="20"
    <Button
        android:text="Button"
        android:id="@+id/button1"
        android:height="100"
        android:width="100" />
    <Button
        android:text="Button"
        android:id="@+id/button2"
        android:height="100"
        android:width="100" />
    <Button
        android:text="Button"
        android:id="@+id/button3"
        android:height="100"
        android:width="100" />
    <Button
        android:text="Button"
        android:id="@+id/button4"
        android:height="100"
        android:width="100" />
    <Button
        android:text="Button"
        android:id="@+id/button5"
        android:height="100"
        android:width="100" />
    <Button
        android:text="Button"
        android:id="@+id/button6"
        android:height="100"
        android:width="100" />
    <Button
        android:text="Button"
        android:id="@+id/button7"
        android:height="100"
        android:width="100" />
    <Button
        android:text="Button"
        android:id="@+id/button8"
        android:height="100"
        android:width="100" />
    <Button
        android:text="Button"
        android:id="@+id/button9"
        android:height="100"
        android:width="100" />
    <Button
        android:text="Button"
        android:id="@+id/button10"
        android:height="100"
        android:width="100" />
</GridLayout>

1 个答案:

答案 0 :(得分:0)

如果您数出它指向的第17行,您将到达此行

android:height="100"

请注意“未绑定前缀”或该值如何没有单位(dp / sp)。 请解决该问题,并将所有其他长度测量值都包含一个测量单位,以便绑定前缀:

android:height="100dp"