我在样式中定义了layout_width和layout_height,所以它实际上是设置的,但集成开发环境看不到我的样式,并使用android:layout_height="0dp“android:layout_width="0dp”自动完成我的代码。
代码示例:生成或在设计/文本集成开发环境之间切换时,添加到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
发布于 2016-10-19 01:48:16
这听起来像是个bug --你能把它放到code.google.com上吗?谢谢!
发布于 2016-10-20 11:18:02
我发现了同样的问题,我发现添加android:layout_height="0dp“是因为为这个视图添加了visible="gone”,在我的例子中,删除它并以编程方式设置Visible工作,希望它能为你工作!
https://stackoverflow.com/questions/40110403
复制相似问题