Android layout 相对布局问题:未找到与给定名称匹配的资源
这个问题让我发疯了。。。 我想这样做: 这是我在xml布局文件中的简单代码:Android layout 相对布局问题:未找到与给定名称匹配的资源,android-layout,xamarin,android-relativelayout,Android Layout,Xamarin,Android Relativelayout,这个问题让我发疯了。。。 我想这样做: 这是我在xml布局文件中的简单代码: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:p1="http://schemas.android.com/apk/res/android" p1:minWidth="25px" p1:minHeight="25px" p1:layout_width="match_parent" p1
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:p1="http://schemas.android.com/apk/res/android"
p1:minWidth="25px"
p1:minHeight="25px"
p1:layout_width="match_parent"
p1:layout_height="match_parent"
p1:id="@+id/relativeLayout1">
<WebView
p1:layout_width="match_parent"
p1:layout_height="wrap_content"
p1:id="@+id/webView1"
p1:layout_alignParentTop="true"
p1:layout_above="@id/textView1" />
<TextView
p1:text="Medium Text"
p1:textAppearance="?android:attr/textAppearanceMedium"
p1:layout_width="match_parent"
p1:layout_height="wrap_content"
p1:id="@+id/textView1"
p1:layout_alignParentBottom="true" />
</RelativeLayout>
但我收到的错误是:
错误:未找到与给定名称匹配的资源(位于“layout_above”处,值为“@id/textView1”)
这对我来说太奇怪了。。。。因为我已经指定了textView1
有什么主意 id为
textView1
的TextView
在引用它的WebView
之后解析。使用@id/*
语法指定解析器正在解析现有id。在这种情况下,它将失败,因为您的TextView
尚未解析
使用上面的
layout_=@+id/textView1
预先声明您的TextView的id。是的,我注意到了这一点。连接两个对象时,布局编辑器失败。。。。它忽略了@和id之间的“+”符号!!!谢谢Matt。如果它解决了您的问题,通常最好将其标记为已接受,以便将来的读者知道这是一个解决方案。:)这对我来说不起作用,我必须重新排序.axml文件的元素以使其能够构建