微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android – RelativeLayout的layout_above给出“找不到资源”错误

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
  <ListView
      android:layout_above="@id/btn_4"    <-- this line error: No resource found
      android:layout_width="match_parent"
      android:layout_height="200dp" />
  <Button android:id="@+id/btn_4"         <-- I declare the id here
      android:layout_alignParentBottom="true"
      android:layout_height="wrap_content"
      android:layout_width="match_parent" />
</RelativeLayout>

有什么建议么?

解决方法

据了解,第一次在布局xml中使用了一个ID,它需要在其前面有一个标志.

Declaring Layout文档:

The plus-symbol (+) means that this is a new resource name that must be created and added to our resources (in the R.java file).

所以,在ListView布局中的第一个btn_4引用添加一个”,你可以从Button布局中的android:id属性删除不必要的”.

原文地址:https://www.jb51.cc/android/312444.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐