android - 包含在 Eclipse 中用于抛出 "no resource found"的布局

标签 android eclipse layout

我对 Java 和 Eclipse 完全陌生。我在/res/layout 下有两个布局文件:

activity_main.xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
    <include layout="@layout/layoutTst" />
</LinearLayout>

layout_test.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/layoutTst"
    android:orientation="vertical" >
</LinearLayout>

当我尝试在“include”部分进行编译时,我收到了这条消息:

Description Resource    Path    Location    Type error: Error: No resource
found that matches the given name (at 'layout' with value
'@layout/layoutTst').   activity_main.xml   /YouSherlock/res/layout line
6   Android AAPT Problem

怎么了?

最佳答案

您需要包含布局文件名 (layout_test.xml),而不是该布局中根的 ID。

<include layout="@layout/layout_test" />

关于android - 包含在 Eclipse 中用于抛出 "no resource found"的布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13594105/

相关文章:

java - 项目中所需库 tomcat-embed-websocket 的存档无法读取或不是有效的 ZIP 文件

java - TextViews 在阿拉伯语言设备中的位置已更改

android - Gradle 构建失败的Android项目

android - Delphi XE6 和 Android(estimote beacon sdk) ClassCastException

android - android studio 中 Activity 开关的 Espresso 单元测试用例

android - Android 的元标记 "apple-mobile-web-app-capable"?

java - Eclipse 终止应用程序服务器和 GWT 开发模式的快捷键

eclipse - 使用 Eclipse 远程调试 Tomcat

html - 在页面上居中(垂直和水平)显示一张图像(尺寸未知)

Android 布局溢出问题