我在样式中定义了 layout_width 和 layout_height,所以它实际上是设置的,但是 IDE 看不到我的样式并使用 android:layout_height="0dp" android:layout_width="0dp" 自动完成我的代码
代码示例:当我在设计/文本 IDE 之间进行构建或切换时,添加到 TextView android:layout_height="0dp" android:layout_width="0dp"
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_contact_phone"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginTop="15dp"
android:src="@drawable/ic_phone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_contact_phone"
style="@style/FormValue"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
app:layout_constraintLeft_toRightOf="@+id/iv_contact_phone"
app:layout_constraintTop_toTopOf="parent" /></android.support.constraint.ConstraintLayout>
忘了说:
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha9'
Androd Studio 2.2.1