android xml布局文件中使用RelativeLayout,明明有这个id,却提示找不到---->解决办法

RelativeLayouterror: Error:
No resource found that matches the given name (at ‘layout_above’ with value ‘@id/bottom_menu’).找不到id资源

因为程序由上到下执行的,XML的ID也是从上到下加载的,所以
先引用的必须使用“@+id”,系统会此变量,先申明在R文件中

后面的textview的id,就赋值为,已存在的“id”

这样就可以正常引用 了

<RelativeLayout
.....
>
    <Button 
        android:layout_below="@+id/texview"
    />
    <TextView
        android:id="@id/textView"
    />
</RelativeLayout>
关注我
原文地址:https://www.cnblogs.com/zengmianhui/p/12634092.html