einfach die äußersten linken und rechten Tasten zum Rand des Mutter beschränken und behindern die inneren Knöpfe gegen die äußeren Tasten.
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#eee">
<Button
android:id="@+id/l1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="L1"
app:layout_constraintLeft_toLeftOf="parent"/>
<Button
android:id="@+id/l2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="L2"
app:layout_constraintLeft_toRightOf="@+id/l1"/>
<Button
android:id="@+id/r1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="R1"
app:layout_constraintRight_toLeftOf="@+id/r2"/>
<Button
android:id="@+id/r2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="R2"
app:layout_constraintRight_toRightOf="parent"/>
</android.support.constraint.ConstraintLayout>
Ich denke, ein 'RelativeLayout' wäre in dieser Situation besser geeignet. –
Vielleicht hast du Recht, aber ich habe auch andere Elemente, die mit Constraint Layout auslegt. Es ist so etwas wie Gamepad Controller Emulator –