In ConstraintLayout how to center the buttons?

0

I'm using frameLayout (ConstraintLayout) , where I have some buttons and I'm trying to keep them centered:

The problem is that when the mobile is vertical they look good,

But when you put it horizontally, the buttons are separated leaving more space between the buttons,

I suppose that, in a bigger screen like a Tablet, there would be more separation between the buttons, how can I make them all in the center, but with the same distance between them?

Documents.xml

<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:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.SoCu.CirDocu.Documentos">


<ImageView
    android:id="@+id/imageView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="62dp"
    android:adjustViewBounds="true"
    android:contentDescription="@string/Nombre1"
    android:scaleType="fitCenter"
    android:src="@drawable/imagen"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<Button
    android:id="@+id/btCo_A"
    android:layout_width="74dp"
    android:layout_height="48dp"
    android:layout_marginTop="28dp"
    android:adjustViewBounds="true"
    android:background="@android:color/transparent"
    android:contentDescription="@string/Nombre2"
    android:drawableStart="@drawable/co_a"
    android:elevation="0dp"
    android:scaleType="fitCenter"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toEndOf="@+id/btCo_EXP"
    app:layout_constraintTop_toBottomOf="@+id/imageView" />

<Button
    android:id="@+id/btCo_C"
    android:layout_width="74dp"
    android:layout_height="48dp"
    android:layout_marginTop="28dp"
    android:adjustViewBounds="true"
    android:background="@android:color/transparent"
    android:contentDescription="@string/Nombre3"
    android:drawableStart="@drawable/co_c"
    android:scaleType="fitCenter"
    app:layout_constraintEnd_toStartOf="@+id/btCo_P"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/imageView" />

<Button
    android:id="@+id/btCo_P"
    android:layout_width="74dp"
    android:layout_height="48dp"
    android:layout_marginTop="28dp"
    android:adjustViewBounds="true"
    android:background="@android:color/transparent"
    android:contentDescription="@string/Nombre4"
    android:drawableStart="@drawable/con_p"
    android:elevation="0dp"
    android:scaleType="fitCenter"
    app:layout_constraintEnd_toStartOf="@+id/btCo_EXP"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toEndOf="@+id/btCo_C"
    app:layout_constraintTop_toBottomOf="@+id/imageView" />

<Button
    android:id="@+id/btCo_EXP"
    android:layout_width="77dp"
    android:layout_height="48dp"
    android:layout_marginTop="28dp"
    android:adjustViewBounds="true"
    android:background="@android:color/transparent"
    android:contentDescription="@string/Nombre5"
    android:drawableStart="@drawable/con_exp"
    android:scaleType="fitCenter"
    app:layout_constraintEnd_toStartOf="@+id/btCon_A"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toEndOf="@+id/btCo_P"
    app:layout_constraintTop_toBottomOf="@+id/imageView" />

</android.support.constraint.ConstraintLayout>

Thank you.

    
asked by SoCu 03.09.2018 в 18:39
source

0 answers