Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RelativeLayout's layout_above gives "No resource found" error

<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>

Any suggestions?

like image 504
Eric Lin Avatar asked Aug 15 '11 14:08

Eric Lin


1 Answers

When you declare relative layouts, you have to use android:layout_above="@+id/layoutToBeAbove"

Otherwise, the system does not know what you're pointing at.

This declaration will point at the same resource.

Hope this helped!

like image 71
Codeman Avatar answered Oct 20 '22 14:10

Codeman