代码之家  ›  专栏  ›  技术社区  ›  james

对一个文件使用带有错误的布局的合并,而对另一个文件则没有错误。同样的代码!

  •  0
  • james  · 技术社区  · 15 年前

    我正在创建一些根元素为 merge . 里面 合并 元素我有一个 ScrollView 包含一个 TextView . 文件如下:

    <?xml version="1.0" encoding="utf-8"?>
    <merge
      xmlns:android="http://schemas.android.com/apk/res/android">
      <ScrollView
        android:id="@+id/scroll"
        android:padding="6dp"
        android:layout_below="@id/headingLayout"
        android:layout_above="@id/tabsLayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
        <TextView
          android:id="@+id/aboutTxt"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" />
      </ScrollView>
    </merge>
    

    我有两个错误:没有资源匹配 layout_below layout_above 我写的名字。

    我有另一个布局XML文件,其中包含非常相似的组件,其中一些组件还引用了 @id/headingLayout @id/tabsLayout . 这两个XML布局文件都不包含名为的组件 headingLayout tabsLayout

    为什么一个布局文件对这些引用没有错误,而另一个布局文件却没有?我做错了什么?在我把这个合并添加到另一个布局之前,这个应用程序会像我预期的那样构建和运行?

    我甚至尝试从工作布局文件复制XML,以发现它给出了相同的错误,我的新布局文件肯定有问题。我尝试过清理、重建、打开/关闭Eclipse。

    1 回复  |  直到 15 年前
        1
  •  0
  •   james    15 年前

    about.xml merge home.xml base_layout.xml

    Package Explorer layout

    aaa_base_layout.xml