android包含标签 - 无效的布局参考 [英] android include tag - invalid layout reference

查看:17
本文介绍了android包含标签 - 无效的布局参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在通过 android 布局 xml 文件中的 include 标记包含不同布局时遇到问题.在指定布局参考 (@layout/...) 时,我在 Eclipse ADT 中收到 InflateException 并出现以下错误:InflateException:您必须指定有效的布局参考.布局 ID @layout/func_edit_simple_calculator_toolbox 无效.

I'm having a problem including a different layout through the include tag in the android layout xml file. When specifing the layout reference ( @layout/... ), i'm getting a InflateException in the Eclipse ADT with the following error: InflateException: You must specifiy a valid layout reference. The layout ID @layout/func_edit_simple_calculator_toolbox is not valid.

引用应该是有效的,因为我是从我的其他布局列表中选择的,但没有输入.我使用的是 android sdk v2.1

the reference should be valid, as I've selected it from the the list of my other layouts and didnt type it in. I'm using android sdk v2.1

这些是布局文件

func_edit_simple_calculator_toolbox.xml

func_edit_simple_calculator_toolbox.xml

<?xml version="1.0" encoding="utf-8"?>
<TableLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_height="wrap_content" android:layout_width="wrap_content">

<TableRow android:id="@+id/TableRow01" android:layout_width="wrap_content"android:layout_height="wrap_content">
<Button android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="1"></Button>
<Button android:id="@+id/Button02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="2"></Button>
<Button android:id="@+id/Button03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="3"></Button>
<Button android:id="@+id/Button04" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="+"></Button>
</TableRow>
<TableRow android:id="@+id/TableRow02" android:layout_width="wrap_content" android:layout_height="wrap_content">
<Button android:id="@+id/Button05" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="4"></Button>
<Button android:id="@+id/Button06" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="5"></Button>
<Button android:id="@+id/Button07" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="6"></Button>
<Button android:id="@+id/Button08" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="-"></Button>
</TableRow>
</TableLayout>

function_editor_layout.xml

function_editor_layout.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

<com.calculoid.FunctionView android:id="@+id/function_view" android:layout_width="fill_parent" android:layout_height="fill_parent"/>

<include android:id="@+id/include01" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/func_edit_simple_calculator_toolbox"></include>
</LinearLayout>

有人知道可能是什么问题吗?

Does any one know what could be the problem?

提前致谢

推荐答案

我想我应该提到我是如何解决同样的问题的.尝试清理项目并没有奏效.我有相当大的布局名称(chrono_first_small_field),这也不是原因.

I think i should mention how i solved the same problem. Tried cleaning the project and didn't work. I have quite large names for the layout (chrono_first_small_field), and that wasn't the cause either.

关闭 Eclipse,然后再次打开它,就成功了.

这比必须实现 onMeasure 方法更有意义 :-)

That makes more sense than having to implement the onMeasure method :-)

这篇关于android包含标签 - 无效的布局参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆