Order of Elements in axml in Xamarin Android leads to compilation error

gulshan_mandalgulshan_mandal Member
edited August 2018 in Xamarin.Android

I am getting compilation error in axml where I have referenced the item before declaring it.

This is happening both for Relative Layout and Constraint Layout

As far as I know, Android doesn't have any such constraints. Moreover, if I copy paste the same layout in Android studio it works fine. I am using Visual Studio for Mac.

Does anyone know a workaround of this issue in Xamarin.Android

The error is:

 error APT0000: No resource found that matches the given name (at 'layout_below' with value '@id/textView1').

Here is my layout code (i have removed the namespace as it doesn't allow me to submit the post):

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
     xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:minWidth="25px"
    android:minHeight="25px">
    <Button
        android:id="@+id/button1"
        android:text="Button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_below="@id/textView1" />
    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="Hello World" />
</RelativeLayout>

Best Answer

Answers

Sign In or Register to comment.