Как сделать два текстовых представления в ConstraintLayout в CardView заподлицо? - PullRequest
0 голосов
/ 04 июня 2018

Я немного новичок в разработке под Android, поэтому прошу прощения, если этот вопрос прост.У меня есть два текстовых представления, сложенных вертикально, и я бы хотел быть на одном уровне друг с другом.Слишком много пробелов между двумя элементами:

Example layout

У меня есть следующий макет действия, в котором я пытался сделать TextViews сбрасываемыми с помощьюпросмотр ограничений и установка поля между нижней и верхней частями равным 0dp:

<?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:id="@+id/linearLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".PackageService">

    <android.support.v7.widget.CardView
        android:id="@+id/card_inventory"
        android:layout_width="match_parent"
        android:layout_height="101dp"
        android:layout_marginBottom="1dp"
        android:layout_marginTop="1dp">

        <android.support.constraint.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <ImageView
                android:id="@+id/image_inventory"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="8dp"
                android:layout_marginEnd="8dp"
                android:layout_marginStart="8dp"
                android:layout_marginTop="8dp"
                android:src="@android:drawable/btn_star"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHorizontal_bias="0.048"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintVertical_bias="0.49" />

            <TextView
                android:id="@+id/text_inventory"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0dp"
                android:layout_marginStart="32dp"
                android:text="Button Title"
                android:textAppearance="@android:style/TextAppearance.Material.Large"
                app:layout_constraintBottom_toTopOf="@id/text_last_scan"
                app:layout_constraintStart_toEndOf="@+id/image_inventory"
                app:layout_constraintTop_toTopOf="parent" />

            <TextView
                android:id="@+id/text_last_scan"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Button Subtitle"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="@+id/text_inventory"
                app:layout_constraintTop_toBottomOf="@+id/text_inventory" />
        </android.support.constraint.ConstraintLayout>
    </android.support.v7.widget.CardView>
</LinearLayout>

Любая помощь приветствуется.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...