【发布时间】:2011-02-07 13:33:59
【问题描述】:
在我的 Android 布局文件中使用
“包含标签已损坏(覆盖布局参数永远不会起作用)”
由于 Romain 表示这在测试套件和他的示例中有效,我一定是做错了什么。
我的项目是这样组织的:
res/layout
buttons.xml
res/layout-land
receipt.xml
res/layout-port
receipt.xml
buttons.xml 包含如下内容:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button .../>
<Button .../>
</LinearLayout>
纵向和横向的receipt.xml 文件看起来像:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
...
<!-- Overridden attributes never work. Nor do attributes like
the red background, which is specified here. -->
<include
android:id="@+id/buttons_override"
android:background="#ff0000"
android:layout_width="fill_parent"
layout="@layout/buttons"/>
</LinearLayout>
我错过了什么?
【问题讨论】:
-
当您尝试以不受支持的方式使用包含时,Android 开发人员工具会引用此问题。