title: Custom Class with Constraint Layout, Android Studio HANGS
body: <p>I'm trying to implement a custom class that implements ConstraintLayout, but the problem is that when I try to use this in XML the Android Studio just hangs, everything freezes, you can't do anything, you can just close the Studio through the Task Manager. Then you reopen, but if you open that XML file, it is the same story again. </p>
  
  <p>I get this:
  Preview timed out while rendering the layout. This typically happens when there is an infinite loop or unbounded recursion in one of the custom views.</p>
  
  <p>Basically first i designed the UI through ConstraintLayout, then i tried just replacing ConstraintLayout with this Class, and then when it tries to render it just freezes. I can't give much code because of NDA.</p>
  
  <p>Class:</p>
  
  <pre><code>    public class ExtraView extends ConstraintLayout {
  
          public ExtraView(Context context) {
              super(context);
              init(context);
          }
  
          public ExtraView (Context context, AttributeSet attrs) {
              super(context, attrs);
              init(context);
          }
  
          public ExtraView (Context context, AttributeSet attrs, int defStyleAttr) {
              super(context, attrs, defStyleAttr);
              init(context);
          }
  
          public void init(Context context){
              View v = LayoutInflater.from(context).inflate(R.layout.view_extra_rent_booking, this, true);
              Butterknife.bind(this,v);
          }
      }
  </code></pre>
  
  <p>XML</p>
  
  <pre><code>&lt;package.ExtraView 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:id="@+id/rentExtraLayout"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:animateLayoutChanges="true"
      android:background="@color/white"&gt;
  
          &lt;TextView
              android:id="@+id/nameTextView"
              style="@style/contentTextDark"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginLeft="40dp"
              android:layout_marginStart="40dp"
              android:layout_marginTop="18dp"
              app:layout_constraintLeft_toLeftOf="parent"
              app:layout_constraintTop_toTopOf="parent"
              tools:text="@string/gps_extra" /&gt;
  
          &lt;ImageView
              android:id="@+id/checkImageView"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginEnd="16dp"
              android:layout_marginRight="16dp"
              android:src="@drawable/icon_checkmark_dark"
              app:layout_constraintBottom_toBottomOf="@+id/nameTextView"
              app:layout_constraintRight_toRightOf="parent"
              app:layout_constraintTop_toTopOf="@+id/nameTextView" /&gt;
  
          &lt;TextView
              android:id="@+id/priceTextView"
              style="@style/contentTextDark"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginEnd="24dp"
              android:layout_marginRight="24dp"
              app:layout_constraintRight_toLeftOf="@+id/checkImageView"
              app:layout_constraintTop_toTopOf="@+id/nameTextView"
              tools:text="+xx€" /&gt;
  
          &lt;View
              android:id="@+id/lineSplitting"
              android:layout_width="0dp"
              android:layout_height="1dp"
              android:layout_alignParentBottom="true"
              android:layout_marginTop="10dp"
              android:background="@color/green"
              app:layout_constraintHorizontal_bias="0.0"
              app:layout_constraintLeft_toLeftOf="@+id/nameTextView"
              app:layout_constraintRight_toRightOf="parent"
              app:layout_constraintTop_toBottomOf="@+id/nameTextView" /&gt;
  
  
          &lt;LinearLayout
              android:id="@+id/expandViewLinearLayout"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:gravity="center"
              android:orientation="vertical"
              android:visibility="gone"
              app:layout_constraintLeft_toLeftOf="parent"
              app:layout_constraintRight_toRightOf="parent"
              app:layout_constraintTop_toBottomOf="@+id/lineSplitting"&gt;&lt;/LinearLayout&gt;
  &lt;/package.ExtraView&gt;
  </code></pre>
  
  <p>This will make Android Studio hang and the app will crash when opening this xml. But with ConstraintLayout it works. What am i doing wrong? I've got latest libraries downloaded. </p>