我有一个名为a.xml的文件中包含一个ListView。
<ListView
android:id="@+id/mylistview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:scrollbars="none"
android:layout_above="XYZ"
/>
在a.xml文件中,我还包含了另一个名为b.xml的文件。
<include android:id="@+id/bottombar" layout="@layout/b" />
在 ListView 的一个设置中,我想要引用在 b.xml 文件中存在的 id(XYZ)。
我能做到这一点吗?
我尝试了以下方法:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<include android:id="@+id/bottombar" layout="@layout/b" />
<ListView
android:id="@+id/mylistview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:scrollbars="none"
android:layout_above="@id/bottombar_background"
/>
</RelativeLayout>
在@layout/b中存在@id/bottombar_background,但是Eclipse给我抛出“无资源”错误。