@JordanBelford

Какой атрибут отвечает за вертикальное выравнивание?

Ребят, с помощью какого атрибута можно выровнять по центру(вертикально)?
3c4f0e81852f484787cb6cb80042db47.png
У TextView и ListView высота задана в 50 dp.
  • Вопрос задан
  • 426 просмотров
Решения вопроса 1
a13xsus
@a13xsus
Lazy developer
Если так:
ce9b899aef5641d39e538d409290d277.png
тогда каждому текствью "Где" и "Когда" добавь android:gravity="center_vertical"

spoiler
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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/BackgroundContent"
    tools:context="com.example.user.dbv2.Content_mainActivity"
    tools:layout_editor_absoluteX="0dp"
    tools:layout_editor_absoluteY="25dp">

    <TextView
        android:id="@+id/textView3"
        android:layout_width="0dp"
        android:layout_height="23dp"
        android:layout_marginBottom="50dp"
        android:layout_marginTop="49dp"
        android:text="Вождение"
        android:textSize="17sp"
        app:layout_constraintBottom_toBottomOf="@+id/textView7"
        app:layout_constraintLeft_toLeftOf="@+id/textView7"
        app:layout_constraintRight_toRightOf="@+id/textView4"
        app:layout_constraintTop_toTopOf="parent"
        tools:layout_constraintBottom_creator="1"
        tools:layout_constraintLeft_creator="1"
        tools:layout_constraintRight_creator="1"
        tools:layout_constraintTop_creator="1"/>

    <TextView
        android:id="@+id/textView4"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="Теория"
        android:textSize="17sp"
        app:layout_constraintBottom_toTopOf="@+id/textView8"
        app:layout_constraintLeft_toLeftOf="@+id/textView8"
        app:layout_constraintRight_toRightOf="@+id/teor"
        tools:layout_constraintBottom_creator="1"
        tools:layout_constraintLeft_creator="1"
        tools:layout_constraintRight_creator="1"/>

    <TextView
        android:id="@+id/textView7"
        android:layout_width="60dp"
        android:layout_height="50dp"
        android:layout_marginStart="108dp"
        android:layout_marginTop="72dp"
        android:gravity="center_vertical"
        android:text="Где:"
        android:textSize="17sp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:layout_constraintLeft_creator="1"
        tools:layout_constraintTop_creator="1"/>

    <TextView
        android:id="@+id/textView6"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:gravity="center_vertical"
        android:text="Когда:"
        android:textSize="17sp"
        app:layout_constraintBottom_toBottomOf="@+id/discr_for_tasks_test"
        app:layout_constraintLeft_toLeftOf="@+id/textView7"
        app:layout_constraintRight_toRightOf="@+id/textView7"
        app:layout_constraintTop_toBottomOf="@+id/textView7"
        tools:layout_constraintBottom_creator="1"
        tools:layout_constraintLeft_creator="1"
        tools:layout_constraintRight_creator="1"
        tools:layout_constraintTop_creator="1"/>

    <ListView
        android:id="@+id/discr_for_tasks_test"
        android:layout_width="0dp"
        android:layout_height="50dp"
        android:divider="@null"
        android:textSize="17sp"
        app:layout_constraintLeft_toLeftOf="@+id/discr_for_tasks"
        app:layout_constraintRight_toRightOf="@+id/discr_for_tasks"
        app:layout_constraintTop_toBottomOf="@+id/discr_for_tasks"
        tools:layout_constraintLeft_creator="1"
        tools:layout_constraintRight_creator="1"
        tools:layout_constraintTop_creator="1"/>

    <TextView
        android:id="@+id/textView8"
        android:layout_width="0dp"
        android:layout_height="50dp"
        android:layout_marginTop="48dp"
        android:gravity="center_vertical"
        android:text="Где:"
        android:textSize="17sp"
        app:layout_constraintLeft_toLeftOf="@+id/textView6"
        app:layout_constraintRight_toRightOf="@+id/textView6"
        app:layout_constraintTop_toBottomOf="@+id/textView6"
        tools:layout_constraintLeft_creator="1"
        tools:layout_constraintRight_creator="1"
        tools:layout_constraintTop_creator="1"/>

    <TextView
        android:id="@+id/textView9"
        android:layout_width="0dp"
        android:layout_height="50dp"
        android:gravity="center_vertical"
        android:text="Когда:"
        android:textSize="17sp"
        app:layout_constraintLeft_toLeftOf="@+id/textView8"
        app:layout_constraintRight_toRightOf="@+id/textView8"
        app:layout_constraintTop_toBottomOf="@+id/textView8"
        tools:layout_constraintLeft_creator="1"
        tools:layout_constraintRight_creator="1"
        tools:layout_constraintTop_creator="1"/>

    <ListView
        android:id="@+id/discr_for_tasks"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginEnd="15dp"
        android:layout_marginStart="1dp"
        android:divider="@null"
        android:textSize="17sp"
        app:layout_constraintBottom_toBottomOf="@+id/textView7"
        app:layout_constraintLeft_toRightOf="@+id/textView7"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView3"
        tools:layout_constraintBottom_creator="1"
        tools:layout_constraintLeft_creator="1"
        tools:layout_constraintRight_creator="1"
        tools:layout_constraintTop_creator="1"/>

    <ListView
        android:id="@+id/teor"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginEnd="1dp"
        android:divider="@null"
        android:textSize="17sp"
        app:layout_constraintBottom_toBottomOf="@+id/textView8"
        app:layout_constraintLeft_toRightOf="@+id/textView8"
        app:layout_constraintRight_toRightOf="@+id/discr_for_tasks_test"
        app:layout_constraintTop_toBottomOf="@+id/textView4"
        tools:layout_constraintBottom_creator="1"
        tools:layout_constraintLeft_creator="1"
        tools:layout_constraintRight_creator="1"
        tools:layout_constraintTop_creator="1"/>

    <ListView
        android:id="@+id/teor2"
        android:layout_width="0dp"
        android:layout_height="50dp"
        android:divider="@null"
        android:textSize="17sp"
        app:layout_constraintLeft_toLeftOf="@+id/teor"
        app:layout_constraintRight_toRightOf="@+id/teor"
        app:layout_constraintTop_toBottomOf="@+id/teor"
        tools:layout_constraintLeft_creator="1"
        tools:layout_constraintRight_creator="1"
        tools:layout_constraintTop_creator="1"/>

</android.support.constraint.ConstraintLayout>
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы