Макет обрезается на круглом подбородке - PullRequest
0 голосов
/ 06 мая 2019

Схема ниже обрезается на устройстве с круглым подбородком Wear.Устройство с круглым подбородком Wear отображает только первые TextView.

<?xml version="1.0" encoding="utf-8"?>
<android.support.wear.widget.BoxInsetLayout xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/lytLoginMain"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:boxedEdges="all">

        <TextView
            android:id="@+id/lblDlgLogoutTitle"
            style="@style/Title"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:layout_marginEnd="16dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            tools:text="Hi Employee #1" />

        <TextView
            android:id="@+id/lblDlgLogoutMessage"
            style="@style/Details"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:layout_marginTop="16dp"
            android:layout_marginEnd="16dp"
            android:background="@color/colorAccent"
            android:gravity="center_horizontal"
            android:text="@string/logout_msg"
            android:textColor="@color/black"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/lblDlgLogoutTitle" />

    </android.support.constraint.ConstraintLayout>

</android.support.wear.widget.BoxInsetLayout>

Но мой макет получил ScrollView, который содержит ConstraintLayout, который содержит 3 TextView и 2 EditTextотображается правильно.

Оба макета используются для AlertDialog, и я не знаю, что не так с моим макетом.

ОБНОВЛЕНИЕ: Я пытался вставить новый TextView ввторой TextView и второй TextView теперь отображаются, но новый TextView не виден.

<?xml version="1.0" encoding="utf-8"?>
<android.support.wear.widget.BoxInsetLayout xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/lytLogoutMain"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:boxedEdges="all">

        <TextView
            android:id="@+id/lblDlgLogoutTitle"
            style="@style/Title"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:layout_marginTop="16dp"
            android:layout_marginEnd="16dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            tools:text="Hi Ricky Manalo" />

        <TextView
            android:id="@+id/lblDlgLogoutMessage"
            style="@style/Details"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:layout_marginTop="16dp"
            android:layout_marginEnd="16dp"
            android:gravity="center_horizontal"
            android:text="@string/logout_msg"
            android:textColor="@color/black"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/lblDlgLogoutTitle" />

        <TextView
            android:id="@+id/textView4"
            android:layout_width="wrap_content"
            android:layout_height="50dp"
            android:layout_marginStart="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:text="TextView"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/lblDlgLogoutMessage" />

    </android.support.constraint.ConstraintLayout>

</android.support.wear.widget.BoxInsetLayout>

This is a sample how my app looks like in a round chin

Ответы [ 2 ]

1 голос
/ 10 мая 2019

Вы пробовали android: fitsSystemWindows = "true"? Больше здесь: https://developer.android.com/training/wearables/ui/layouts

0 голосов
/ 11 мая 2019

Используя ответ @ promanowicz и увеличивая marginTop и marginBottom сообщения TextView, я смог отобразить полное сообщение TextView.

Это мой окончательный код.

<TextView
    android:id="@+id/lblDlgLogoutMessage"
    style="@style/Details"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginStart="16dp"
    android:layout_marginTop="32dp"
    android:layout_marginEnd="16dp"
    android:layout_marginBottom="32dp"
    android:fitsSystemWindows="true"
    android:gravity="center_horizontal"
    android:text="@string/logout_msg"
    android:textColor="@color/black"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/lblDlgLogoutTitle" />
...