Я пытаюсь получить что-то подобное в одном из своих заданий:
подробный вид аттракциона
Я хочу, чтобы изображение было закреплено вверху, средний бит с текстом, который нужно прокручивать, так как описание и краткое описание будут иметь довольно много текста, а кнопки будут закреплены внизу. только средний - постоянная видимость, крайние скрыты или видны в зависимости от перечисленного типа аттракциона.
Я пытался вложить в линейные схемы, но не сработало, скорее всего, моя ошибка.
Мой xml файл:
<?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:background="@color/colorAccent"
tools:context=".DetailedViewActivity">
<TextView
android:id="@+id/textViewDetailedName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="16dp"
android:fontFamily="@font/share_bold"
android:text="@string/name"
android:textAlignment="center"
android:textColor="@color/colorDark"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView4" />
<TextView
android:id="@+id/textViewDetailedAddress"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:fontFamily="@font/share"
android:text="@string/address"
android:textAlignment="viewStart"
android:textColor="@color/colorDark"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="@+id/textViewDetailedInfoAddress"
app:layout_constraintStart_toStartOf="@+id/textViewDetailedInfoAddress"
app:layout_constraintTop_toBottomOf="@+id/textViewDetailedInfoAddress" />
<TextView
android:id="@+id/textViewDetailedPostCode"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:fontFamily="@font/share"
android:text="@string/post_code"
android:textAlignment="viewStart"
android:textColor="@color/colorDark"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="@+id/textViewDetailedInfoPostCode"
app:layout_constraintStart_toStartOf="@+id/textViewDetailedInfoPostCode"
app:layout_constraintTop_toBottomOf="@+id/textViewDetailedInfoPostCode" />
<TextView
android:id="@+id/textViewDetailedShortDesc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:fontFamily="@font/share"
android:text="@string/short_description"
android:textAlignment="viewStart"
android:textColor="@color/colorDark"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="@+id/textViewDetailedInfoShortDesc"
app:layout_constraintStart_toStartOf="@+id/textViewDetailedInfoShortDesc"
app:layout_constraintTop_toBottomOf="@+id/textViewDetailedInfoShortDesc" />
<TextView
android:id="@+id/textViewDetailedDesc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:fontFamily="@font/share"
android:text="@string/description"
android:textAlignment="viewStart"
android:textColor="@color/colorDark"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="@+id/textViewDetailedName"
app:layout_constraintStart_toStartOf="@+id/textViewDetailedName"
app:layout_constraintTop_toBottomOf="@+id/textViewDetailedInfoDescription" />
<TextView
android:id="@+id/textViewDetailedPrice"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:fontFamily="@font/share"
android:text="@string/price"
android:textAlignment="viewStart"
android:textColor="@color/colorDark"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="@+id/textViewDetailedName"
app:layout_constraintStart_toStartOf="@+id/textViewDetailedName"
app:layout_constraintTop_toBottomOf="@+id/textViewDetailedInfoPrice" />
<TextView
android:id="@+id/textViewDetailedInfoAddress"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:fontFamily="@font/share"
android:text="@string/address"
android:textColor="@color/colorTeal"
app:layout_constraintEnd_toEndOf="@+id/textViewDetailedName"
app:layout_constraintStart_toStartOf="@+id/textViewDetailedName"
app:layout_constraintTop_toBottomOf="@+id/textViewDetailedName" />
<TextView
android:id="@+id/textViewDetailedInfoPostCode"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:fontFamily="@font/share"
android:text="@string/post_code"
android:textColor="@color/colorTeal"
app:layout_constraintEnd_toEndOf="@+id/textViewDetailedAddress"
app:layout_constraintStart_toStartOf="@+id/textViewDetailedAddress"
app:layout_constraintTop_toBottomOf="@+id/textViewDetailedAddress" />
<TextView
android:id="@+id/textViewDetailedInfoShortDesc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:fontFamily="@font/share"
android:text="@string/short_description"
android:textColor="@color/colorTeal"
app:layout_constraintEnd_toEndOf="@+id/textViewDetailedPostCode"
app:layout_constraintStart_toStartOf="@+id/textViewDetailedPostCode"
app:layout_constraintTop_toBottomOf="@+id/textViewDetailedPostCode" />
<TextView
android:id="@+id/textViewDetailedInfoDescription"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:fontFamily="@font/share"
android:text="@string/description"
android:textColor="@color/colorTeal"
app:layout_constraintEnd_toEndOf="@+id/textViewDetailedShortDesc"
app:layout_constraintStart_toStartOf="@+id/textViewDetailedShortDesc"
app:layout_constraintTop_toBottomOf="@+id/textViewDetailedShortDesc" />
<TextView
android:id="@+id/textViewDetailedInfoPrice"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:fontFamily="@font/share"
android:text="@string/price"
android:textColor="@color/colorTeal"
app:layout_constraintEnd_toEndOf="@+id/textViewDetailedDesc"
app:layout_constraintStart_toStartOf="@+id/textViewDetailedDesc"
app:layout_constraintTop_toBottomOf="@+id/textViewDetailedDesc" />
<ImageView
android:id="@+id/imageView4"
android:layout_width="match_parent"
android:layout_height="270dp"
android:scaleType="fitXY"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_image" />
<Button
android:id="@+id/btnReadReviews"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginBottom="32dp"
android:fontFamily="@font/share_bold"
android:text="@string/read_reviews"
android:textAllCaps="false"
android:textColor="@color/colorDark"
android:textSize="14sp"
app:backgroundTint="@color/colorPrimary"
app:cornerRadius="7dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/btnBook"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:layout_marginBottom="32dp"
android:fontFamily="@font/share_bold"
android:text="@string/book"
android:textAllCaps="false"
android:textColor="@color/colorDark"
android:textSize="14sp"
app:backgroundTint="@color/colorPrimary"
app:cornerRadius="7dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<Button
android:id="@+id/btnPostReview"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:fontFamily="@font/share_bold"
android:text="@string/add_review"
android:textAllCaps="false"
android:textColor="@color/colorDark"
android:textSize="14sp"
app:backgroundTint="@color/colorPrimary"
app:cornerRadius="7dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>