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>
posted @ 2016-07-01 18:14  iszengmh  阅读(490)  评论(0编辑  收藏  举报