我对 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/