layout_below - attribute not defined?

I am trying out an example using Xamarin cross platform using Visual Studio Professional 2017. The example code can be found here: https://msdn.microsoft.com/en-us/library/dn879698(v=vs.140).aspx

In the main page XAML, Visual studio flags each line containing layout_below as being invalid, saying that the resource is not defined.

Any ideas on how to fix this would be gladly received.

Here is the XAML code:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/relativeLayout1"
        android:background="#545454">
        <TextView
         android:text="Search by Zip Code"
         android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/ZipCodeSearchLabel"
            android:layout_marginLeft="10dp"
            android:textColor="@android:color/white"
            android:textStyle="bold" />
        <TextView
         android:text="Zip Code"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
         android:layout_below="@id/ZipCodeSearchLabel"
            android:id="@+id/ZipCodeLabel"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="5dp" />
        <EditText
         android:inputType="number"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/ZipCodeLabel"
            android:id="@+id/zipCodeEntry"
            android:layout_marginLeft="10dp"
            android:layout_marginBottom="10dp"
            android:width="165dp" />
        <Button
            android:text="Get Weather"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@id/zipCodeEntry"
            android:id="@+id/weatherBtn"
         android:layout_alignBottom="@id/zipCodeEntry"
            android:layout_marginLeft="20dp"
            android:width="165dp" />
    </RelativeLayout>
</LinearLayout>

Posts

  • prashantvcprashantvc USXamarin Team Xamurai

    It looks like the XML schemas are not detected in the VS, you can find the solution here on Stack overflow https://stackoverflow.com/a/42132223/85606

  • DavidLowreyDavidLowrey USMember

    I copied the two XML files into C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Xml\Schemas

    I still have the problem, even after restarting VS.

    Do I have to do something to update my VS Project with the new files?

  • DavidLowreyDavidLowrey USMember

    For what it's worth, the layout is fine when you run the compiled program. It looks like IntelliSense is having issues with it, and the layout in VS editor looks wrong as well.

  • ma1796ma1796 Member ✭✭

    I have this problem with VS 2017 (15.6.6). Some attributes like layout_toRightOf, layout_alignParentRight etcetera has IntelliSense problem.

  • JrMaciasJrMacias Member ✭✭

    the same problem here, i am using VS 2017 community version, but it's weird cause i got that error message every time i open the VS; but that only happens when i work on my xamarin.android solution and i close the the VS leaving an .axml file on the editor, so the next time i open the solution and the editor tries to recover the .axml file, i got the error message. I really don't know what's happening because in another case, i mean, when i don't leave any .axml file on the editor when i leave i am not getting any error the next time i open the solution....please help, this is driving me crazy...thanks in advance!

Sign In or Register to comment.