我开始使用约束布局,我在单独编译设计文件时遇到断言错误此问题将发生。解决这个问题的正确方法是什么?我搞砸了洞日。这是我的XML设计。
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/cL_Layout"
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="@color/card_background">
android:id="@+id/gL_right_margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.95" />
android:id="@+id/gL_vertical_center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.50364965" />
android:id="@+id/gL_bottom_margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="1.0" />
android:id="@+id/gL_image_size_margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.3" />
android:id="@+id/imgVw_AddClips_recVw_icon"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="4dp"
android:layout_marginStart="4dp"
android:layout_marginTop="4dp"
android:adjustViewBounds="true"
android:background="@drawable/qik_highlights_shape"
android:contentDescription="@string/dummy_content"
android:scaleType="fitCenter"
android:src="@drawable/bg_cloud_icon"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/gL_image_size_margin"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:id="@+id/txtIp_recVw_AddClips_Name_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="@string/recVw_Template_channel"
android:textAllCaps="false"
android:textColor="@color/fa_preview_button_text_grey"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintStart_toEndOf="@+id/gL_image_size_margin"
app:layout_constraintTop_toTopOf="parent" />
android:id="@+id/txtIp_recVw_Components_Name_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginStart="8dp"
android:text="@string/recVw_Template_Components"
android:textAllCaps="false"
android:textColor="@color/fa_preview_button_text_grey"
android:textSize="12sp"
app:layout_constraintStart_toEndOf="@+id/gL_image_size_margin"
app:layout_constraintTop_toBottomOf="@+id/txtIp_recVw_AddClips_Name_title" />
android:id="@+id/txtIp_recVw_channel_subscribers_hint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="@string/channel_subscribers"
android:textAllCaps="false"
android:textColor="@color/fa_preview_button_text_grey"
android:textSize="12sp"
app:layout_constraintStart_toEndOf="@+id/gL_image_size_margin"
app:layout_constraintTop_toBottomOf="@+id/txtIp_recVw_Components_Name_title" />
android:id="@+id/rBtn_AddClips_SelectionIcon"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:button="@drawable/qik_checkbox"
android:text="@null"
android:theme="@null"
app:layout_constraintBottom_toTopOf="@+id/gL_bottom_margin"
app:layout_constraintEnd_toStartOf="@+id/gL_right_margin"
app:layout_constraintTop_toTopOf="parent" />
android:id="@+id/view_template_1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/fa_preview_button_text_grey"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/gL_right_margin"
app:layout_constraintEnd_toEndOf="@+id/gL_right_margin" />
android:id="@+id/view_template_selection"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/fa_green_1"
app:layout_constraintBottom_toBottomOf="@+id/view_template_1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
我的错误日志如下:
java.lang.AssertionError:顶部
在android.support.constraint.solver.widgets.Guideline.getAnchor上(Guideline.java:159)
在android.support.constraint.solver.widgets.ConstraintWidget.immediateConnect上(ConstraintWidget.java:1597)
在android.support.constraint.ConstraintLayout.setChildrenConstraints上(ConstraintLayout.java:1031)
在android.support.constraint.ConstraintLayout.updateHierarchy上(ConstraintLayout.java:794)
在android.support.constraint.ConstraintLayout.onMeasure上(ConstraintLayout.java:1542)
在android.view.view.measure上(view.java:21051)
在android.view.ViewGroup.measureChildWithMargins上(ViewGroup.java:6459)
在android.widget.FrameLayout.onMeasure上(FrameLayout.java:185)
在android.support.v7.widget.ContentFrameLayout.onMeasure上(ContentFrameLayout.java:141)
在android.view.view.measure上(view.java:21051)
在android.view.ViewGroup.measureChildWithMargins上(ViewGroup.java:6459)
在android.widget.LinearLayout.measurechildbeforrelayout(LinearLayout.java:1464)
在android.widget.LinearLayout.measureVertical上(LinearLayout.java:758)
在android.widget.LinearLayout.onMeasure上(LinearLayout.java:640)
在android.view.view.measure上(view.java:21051)
在android.view.ViewGroup.measureChildWithMargins上(ViewGroup.java:6459)
在android.widget.FrameLayout.onMeasure上(FrameLayout.java:185)
在android.view.view.measure上(view.java:21051)
在android.view.ViewGroup.measureChildWithMargins上(ViewGroup.java:6459)
在android.widget.LinearLayout.measurechildbeforrelayout(LinearLayout.java:1464)
在android.widget.LinearLayout.measureVertical上(LinearLayout.java:758)
在android.widget.LinearLayout.onMeasure上(LinearLayout.java:640)
在android.view.view.measure上(view.java:21051)
在android.view.ViewGroup.measureChildWithMargins上(ViewGroup.java:6459)
在android.widget.FrameLayout.onMeasure上(FrameLayout.java:185)
在com.android.internal.policy.DecorView.onMeasure上(DecorView.java:849)
在android.view.view.measure上(view.java:21051)
在android.view.ViewRootImpl.performMeasure上(ViewRootImpl.java:2583)
在android.view.ViewRootImpl.measureHierarchy上(ViewRootImpl.java:1642)
在android.view.ViewRootImpl.performTraversals上(ViewRootImpl.java:1893)
在android.view.ViewRootImpl.doTraversal上(ViewRootImpl.java:1522)
在android.view.ViewRootImpl$TraversalRunnable.run上(ViewRootImpl.java:7098)
在android.view.Choreographer$CallbackRecord.run上(Choreographer.java:927)
在android.view.Choreographer.doCallbacks上(Choreographer.java:702)
在android.view.Choreographer.doFrame上(Choreographer.java:638)
在android.view.Choreographer$FrameDisplayEventReceiver.run上(Choreographer.java:913)
在android.os.Handler.handleCallback上(Handler.java:751)
在android.os.Handler.dispatchMessage上(Handler.java:95)
在android.os.Looper.loop上(Looper.java:154)
在android.app.ActivityThread.main上(ActivityThread.java:6682)
在java.lang.reflect.Method.invoke(本机方法)
在com.android.internal.os.zygenetinit$MethodAndArgsCaller.run上(zygenetinit.java:1520)
在com.android.internal.os.zygenetinit.main上(zygenetinit.java:1410)