android - "No resource found that matches the given name" error even though the names match -


i'm building simple todo list app. i'm trying organise layout positioning them relative 1 another. calling xml attributes android:layout_tostartof="@id/to_do_btn" i'm getting no resource found matches given name error. tried every solution on stackoverflow nothing helped. xml:

<?xml version="1.0" encoding="utf-8"?> <relativelayout     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     tools:context="myapp.onur.todo.mainactivity">      <listview         android:id="@+id/to_do_list"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignparenttop="true"         android:layout_alignparentstart="true"         android:layout_above="@id/to_do_btn"         android:layout_margin="5dp"         >     </listview>      <edittext         android:id="@+id/to_do_edittext"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:hint="enter do"         android:layout_tostartof="@id/to_do_btn"         android:layout_alignparentbottom="true"         android:layout_alignparentstart="true"         android:layout_aligntop="@id/to_do_btn"         android:layout_below="@id/to_do_list"         android:layout_margin="5dp"         />      <button         android:id="@+id/to_do_btn"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="add item"         android:layout_margin="5dp"         android:layout_alignparentbottom="true"         android:layout_alignparentend="true"         />  </relativelayout> 

and example of error: error:(15, 31) no resource found matches given name (at 'layout_above' value '@id/to_do_btn').

i have no idea what's going on. if helps, here gradle dependencies:

dependencies {     compile filetree(include: ['*.jar'], dir: 'libs')     androidtestcompile('com.android.support.test.espresso:espresso-core:2.2.2', {         exclude group: 'com.android.support', module: 'support-annotations'     })     compile 'com.android.support.constraint:constraint-layout:1.0.2'     testcompile 'junit:junit:4.12'     compile 'com.android.support:appcompat-v7:26.0.0-alpha1' } 

change

android:layout_above="@id/to_do_btn" 

to

android:layout_above="@+id/to_do_btn" 

or order layout this

<button         android:id="@+id/to_do_btn"         ...         />  <listview         ...         android:layout_above="@id/to_do_btn"         > </listview> 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -