ConstraintLayout unresolved attributes problem

Hi. I am trying to use ConstraintLayout in a fresh installation of Visual Studio. I added Xamarin.Android.Support.Constraint.Layout and Xamarin.Android.Support.Constraint.Layout.Solver packages from Nuget.

I tried to declare a very simple and small UI in XML, but the ConstraintLayout-specific attributes cannot be resolved by the IDE. The attributes such as app:layout_constraintStart_toStartOf="parent" are underlined in blue and the Error List window gives this explanation: "The 'http://schemas.android.com/apk/res-auto:layout_constraintStart_toStartOf' attribute is not declared."

Interestingly, the code does compile, but as long as the IDE won't resolve the attributes, intellisense won't work and it's a pain to develop in such circumstances.

Is there anyone who has encountered a similar issue?

My example code excerpt is below:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
  <android.support.v7.widget.CardView
      android:id="@+id/cardView"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      app:cardBackgroundColor="@color/colorPaleYellow"
      app:cardElevation="0dp">

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

      <Button
          android:id="@+id/proposal_card__kermis_name_button"
          android:layout_width="wrap_content"
          android:layout_height="30dp"
          android:layout_marginStart="16dp"
          android:layout_marginTop="8dp"
          android:text="Button"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent" />

Best Answer

Answers

  • AdonisVillamorAdonisVillamor USMember ✭✭

    Jesus Christ! how did that became the accepted answer??? Can this post of mine be the accepted answer as well?

  • nick5454nick5454 USUniversity ✭✭
    edited January 11

    Because Xamarin has done nothing to get ConstraintLayout to work other than avoid the Red Screen of death. You can't actually design in Visual Studio.

Sign In or Register to comment.