The components are moved after running the project

37 views Asked by At

I have two problems:

  1. When running the project, the components are moved differently than when designed.
  2. I can't swipe the scroll view to see all the content.

I'm a student and I encountered these problems while doing a project. I'm not good at English so I have to use Google translate to write. I hope you can understand. Thanks a lot.

Here my xml file:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
    tools:context=".Families.CanidaeDetailActivity"
    android:background="@color/body">
    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        >
        <LinearLayout
            android:id="@+id/lnly_class"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:orientation="horizontal"
            app:layout_constraintTop_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">

            <ImageView
                android:id="@+id/iv_back"
                android:layout_width="20dp"
                android:layout_height="20dp"
                android:layout_gravity="center"
                android:layout_marginStart="25dp"
                android:layout_marginTop="0dp"
                android:src="@drawable/hinh_back" />
                <ImageView
                    android:layout_width="20dp"
                    android:layout_height="20dp"
                    android:layout_gravity="center"
                    android:layout_marginStart="80dp"
                    android:src="@drawable/icon_voice"
                    android:contentDescription="TODO" />
                <TextView
                    android:id="@+id/txt_title"
                    android:layout_width="205dp"
                    android:layout_height="match_parent"
                    android:layout_marginStart="10dp"
                    android:gravity="center_vertical"
                    android:text="Lorem ipsum"
                    android:textStyle="bold"
                    android:textColor="@color/white"
                    android:textSize="16sp"
                    tools:ignore="RtlCompat" />
            <ImageView
                android:id="@+id/iv_translator"
                android:layout_width="25dp"
                android:layout_height="25dp"
                android:layout_gravity="center"
                android:layout_marginStart="0dp"
                android:src="@drawable/icon_change_langue"
                />
        </LinearLayout>
        <FrameLayout
            android:id="@+id/fl_image"
            android:layout_width="match_parent"
            android:layout_height="385dp"
            android:background="@color/line1"
            app:layout_constraintTop_toBottomOf="@id/lnly_class"
            >
            <ImageView
                android:id="@+id/iv_canidae"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:adjustViaewBounds="true"
                android:scaleType="centerCrop"
                />
        </FrameLayout>
        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:fillViewport="true"
            app:layout_constraintTop_toBottomOf="@id/fl_image"
            tools:ignore="MissingConstraints">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                >
                <ImageView
                    android:layout_width="20dp"
                    android:layout_height="20dp"
                    android:src="@drawable/icon_voice"
                    android:layout_marginTop="20dp"
                    android:layout_marginStart="30dp"
                    />
                <TextView
                    android:id="@+id/tv_description"
                    android:layout_width="289dp"
                    android:layout_height="wrap_content"
                    android:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris auctor fringilla feugiat. Sed condimentum convallis fringilla. Pellentesque non faucibus enim, sit amet condimentum velit. Curabitur tellus diam, elementum sed tristique vel, eleifend ac ex. Vivamus ex est, dignissim at accumsan posuere, tincidunt non augue. Praesent tempus tellus lacus, ac eleifend felis posuere suscipit. Phasellus facilisis arcu nec ultricies cursus. Integer pulvinar hendrerit augue, in facilisis odio dapibus ac. Ut interdum dolor ut efficitur ultrices. Nam tempus ex eget nunc tristique faucibus."
                    android:justificationMode="inter_word"
                    android:textSize="15sp"
                    android:textColor="@color/white"
                    android:layout_marginStart="10dp"
                    android:layout_marginTop="20dp"
                    />
            </LinearLayout>
        </ScrollView>
    </androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>

Here some photos:
When design
When running

0

There are 0 answers