Android 无法在ConstraintLayout中移动子元素
我正在使用Android Studio GUI编辑器。将Constraintlayout作为根元素后,将按钮添加到布局中。很快它就跳到了左上角。我无法将该按钮移动到布局的中心。请帮忙 以下是我的xml代码:Android 无法在ConstraintLayout中移动子元素,android,layout,Android,Layout,我正在使用Android Studio GUI编辑器。将Constraintlayout作为根元素后,将按钮添加到布局中。很快它就跳到了左上角。我无法将该按钮移动到布局的中心。请帮忙 以下是我的xml代码: <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res
<?xml version="1.0" encoding="utf-8"?>
<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="match_parent">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
根据您提供的xml,按钮已居中。我建议您不要使用GUI编辑器。相反,手工编辑xml并在右侧的预览中查看它。您可以发布您的gradle吗?