【问题标题】:Error parsing XML: not well-formed (invalid token) multicolumn ListView解析 XML 时出错:格式不正确(无效令牌)多列 ListView
【发布时间】:2014-05-21 00:08:20
【问题描述】:

我正在尝试创建一个多列列表视图,并在名为 row 的布局文件夹中创建了一个新的 xml 文件。但是我收到一个错误提示

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

虽然我认为我错过了关闭标签和/或输入错误的内容,但我似乎找不到问题。非常感谢!

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

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


<TextView
     android:id="@+id/name"
    android:gravity="left"
     android:layout_width="50dip"
     android:layout_height="wrap_content" />

<TextView
     android:id="@+id/path"
    android:gravity=”center”
     android:layout_width="70dip"
     android:layout_height="wrap_content"
     android:layout_weight="1" />
</LinearLayout>

【问题讨论】:

  • 您忘记了布局的结束标记。
  • @Onik 我刚刚补充说,但是我仍然遇到同样的错误
  • + 你这里有不同的双引号:android:gravity=”center”
  • 我也改了,还是一样的错误

标签: android xml android-listview


【解决方案1】:

改变这个。

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


<TextView
     android:id="@+id/name"
    android:gravity="left"
     android:layout_width="50dip"
     android:layout_height="wrap_content" />

<TextView
     android:id="@+id/path"
    android:gravity="center" <!-- this -->
     android:layout_width="70dip"
     android:layout_height="wrap_content"
     android:layout_weight="1" />
</LinearLayout>

【讨论】:

  • 您能解释一下问题所在吗?
  • android:gravity="center" 到 android:gravity="center"
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-11-25
  • 1970-01-01
  • 2015-08-28
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多