1

我在样式中定义了 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
4

2 回答 2

0

我发现了同样的问题,我发现添加了 android:layout_height="0dp" 因为为此视图添加了 visible="gone",在我的情况下,删除它并以编程方式设置 Visible 工作,希望它对你有用!

于 2016-10-20T03:18:02.270 回答
0

这听起来像是一个错误——你能把它归档到 code.google.com 上吗?谢谢!

于 2016-10-18T17:48:16.310 回答