Я сделал приложение со студией android, где вы можете заказывать еду и прочее. В приложении есть раздел, где вы можете увидеть все свои заказы, он выглядит так:
Но выравнивание не соответствует. Я имею в виду, что мне нужна строка «Wasser Burger 15.0 ...» под строкой заголовка. Примерно так:
Основной макет действия:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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="#ececec"
android:orientation="vertical">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="65dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp">
<TextView
android:id="@+id/bestellung"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:fontFamily="@font/segoeui_standard"
android:text="@string/user_bestellung"
android:textColor="#000"
android:textSize="20sp"
app:layout_constraintBottom_toTopOf="@+id/cardViewMiddle"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.833" />
<TextView
android:id="@+id/bestellcode"
android:layout_width="53dp"
android:layout_height="wrap_content"
android:fontFamily="@font/segoeui_standard"
android:text="Code"
android:textColor="#000"
android:textSize="20sp"
android:layout_marginLeft="10dp"/>
<TextView
android:id="@+id/betrag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:fontFamily="@font/segoeui_standard"
android:text="@string/user_geld_Betrag"
android:textColor="#000"
android:textSize="20sp"
app:layout_constraintBottom_toTopOf="@+id/cardViewMiddle"
app:layout_constraintStart_toEndOf="@+id/bestellung"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.833" />
<TextView
android:id="@+id/datum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:fontFamily="@font/segoeui_standard"
android:text="@string/user_datum_transaktion"
android:textColor="#000"
android:textSize="20sp"
app:layout_constraintBottom_toTopOf="@+id/cardViewMiddle"
app:layout_constraintStart_toEndOf="@+id/betrag"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.833" />
</LinearLayout>
<androidx.cardview.widget.CardView
android:id="@+id/cardViewMiddle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_gravity="center"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="20dp"
android:elevation="8dp"
android:gravity="center"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="15dp">
<TextView
android:id="@+id/user_order_notfound"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center"
android:visibility="invisible"
android:text="Es gibt noch keine Bestellungen."/>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.core.widget.NestedScrollView
android:id="@+id/nestedScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="true"
app:layout_anchor="@+id/nestedScrollView"
app:layout_anchorGravity="center"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerview_scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/betrag"
app:layout_constraintVertical_bias="0.075"
tools:layout_editor_absoluteX="0dp">
</androidx.recyclerview.widget.RecyclerView>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
А макет элемента списка выглядит так:
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
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="wrap_content"
android:layout_margin="10dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_user_bestellung"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="10">
<TextView
android:id="@+id/code"
android:layout_width="wrap_content"
android:layout_height="19dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/datum"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/datum"
android:layout_width="wrap_content"
android:layout_height="19dp"
android:layout_marginStart="36dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/betrag"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/items"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/betrag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/items"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>