I'm building a simple todo list app. I'm trying to organise my layout by positioning them relative to one another. I do that by calling XML attributes like android:layout_toStartOf="@id/to_do_btn" but however I'm getting a No Resource Found That Matches The Given Name error. I basically tried every solution on Stackoverflow but nothing helped. This is my 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 Something To 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 this is an example of the error: Error:(15, 31) No resource found that matches the given name (at 'layout_above' with value '@id/to_do_btn').
I have no idea what's going on. If it helps, here are my 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'
}