bircastri
bircastri

Reputation: 2169

Spacing in ContraintLayout

I m building Android Application, so this is my Activity xml file:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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="match_parent"
    android:orientation="vertical"
    android:background="@color/white"
    tools:context=".VitalSignActivity">

    <androidx.fragment.app.FragmentContainerView
        android:id="@+id/headerFragmentContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:name="it.eresult.silvermountain.HeaderFragment"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        />

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:orientation="vertical"
        app:layout_constraintTop_toBottomOf="@id/headerFragmentContainer"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent">

        <TextView
            android:id="@+id/text_view_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Frequenza Cardiaca"
            android:layout_marginVertical="0dp"
            android:padding="0dp"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            android:fontFamily="@font/poppins_bold"
            android:textColor="@color/main_green"
            android:textSize="24dp"
             />
        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/about_main_content"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_marginTop="5dp"
            android:background="@drawable/left_corner_rounded_box"
            android:padding="40dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintEnd_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/text_view_title"
            app:layout_constraintVertical_bias="0.0">

            <ImageView
                android:id="@+id/vital_sign_image"
                android:layout_width="150dp"
                android:layout_height="150dp"
                android:scaleType="centerCrop"
                android:contentDescription="desc"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toEndOf="parent"  />

            <TextView
                android:id="@+id/vital_sign_title"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:text="Frequenza cardiaca"
                android:textColor="#000000"
                android:textSize="16sp"
                android:textStyle="bold"
                app:layout_constraintBottom_toBottomOf="@id/vital_sign_image"
                app:layout_constraintEnd_toEndOf="@id/vital_sign_image"
                app:layout_constraintLeft_toLeftOf="parent"/>


        </androidx.constraintlayout.widget.ConstraintLayout>

        <androidx.fragment.app.FragmentContainerView
            android:id="@+id/footer_fragment_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:name="it.eresult.silvermountain.FooterFragment"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            />
    </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

This is the layout:

enter image description here

I need to set spacing from Image and TextView. How can I do?

Upvotes: 0

Views: 17

Answers (0)

Related Questions