【问题标题】:Weird error on Table Layout表格布局上的奇怪错误
【发布时间】:2011-05-04 22:15:29
【问题描述】:

所以我构建了这个相当大的表格布局 xml 文件。图形布局中的视图看起来很完美,但在代码视图中,整个内容都带有橙色下划线并带有错误

在这一行找到多个注释: - 元素类型“按钮”必须后跟属性规范、“>”或“/ ”。 - 未检测到文档的语法约束(DTD 或 XML 模式)。

现在我的所有按钮都已正确标记,并且文档具有 XML 架构,那么可能出了什么问题?

ps。另外,当我去保存它时,控制台会输出“XML 文件中的错误:正在中止构建”

这是我的代码: http://pastebin.com/42GMBmvv

【问题讨论】:

  • 如果您发布您的布局 xml,有人将能够将问题指向您。
  • 你能把xml文件发布到pastebin吗?

标签: android android-layout


【解决方案1】:

注意你是如何拥有的:

android:layout_height="wrap_content"android:layout_weight="0.16"

从按钮的第二行开始,您需要在属性之间留一个“空格”,就像在您的第一个表格行按钮中一样:

android:layout_height="wrap_content" android:layout_weight="0.16"

干杯

【讨论】:

    【解决方案2】:

    您需要从第二批按钮到最后添加空间:

    <Button android:text="" android:id="@+id/x0y1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="0.16"></Button>
                                                                                                                      here ^
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多