0
我想有兩列格在約束佈局方形按鈕,這是我的xml
但它顯示了一個大按鈕,當我加4鍵:電網constraintlayout
,當我刪除2個按鈕每一件事情的偉大工程:
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context="com.example.poory.myapplication.MainActivity">
<Button
android:id="@+id/button"
app:layout_constraintTop_toBottomOf="@id/slider"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="H,1:1"
android:text="Button"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/button2"
android:layout_marginTop="0dp" />
<Button
android:id="@+id/button2"
app:layout_constraintTop_toBottomOf="@id/slider"
android:layout_width="0dp"
android:layout_height="0dp"
android:text="Button"
app:layout_constraintDimensionRatio="H,1:1"
tools:layout_editor_absoluteY="232dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toRightOf="@+id/button" />
<Button
android:id="@+id/button3"
app:layout_constraintTop_toBottomOf="@id/button"
android:layout_width="0dp"
android:layout_height="0dp"
android:text="Button"
app:layout_constraintDimensionRatio="H,1:1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/button2" />
<Button
android:id="@+id/button4"
app:layout_constraintTop_toBottomOf="@id/button2"
android:layout_width="0dp"
android:layout_height="0dp"
android:text="Button"
app:layout_constraintDimensionRatio="H,1:1"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toRightOf="@+id/button" />
</android.support.constraint.ConstraintLayout>
此網格應該是scrollview
,所以我不能使用父母的底部。
您應該使用CTRL + K/CMD + K正確格式的源代碼。 –