我在设置 layout_width layout_height 设置成match_parent 切换到视图的时候 自动变成b 0dp。
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="myapp.truncate.example.com.demo1.MainActivity"
android:orientation="vertical"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_name"
tools:layout_editor_absoluteY="0dp"
tools:layout_editor_absoluteX="0dp" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="0dp" />
</android.support.constraint.ConstraintLayout>
贴出代码,不然看不出。。