Изложил поле TextInputLayout и центр тяжести? - PullRequest
0 голосов
/ 21 ноября 2018

Как добиться нового центрированного стиля OutlinedBox с TextInputLayout ?

Текущее поведение:

left and center

<android.support.design.widget.TextInputLayout
    android:id="@+id/textInputLayout2"
    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="left"
    >
    <android.support.design.widget.TextInputEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="left"
        android:hint="hint"
        />
</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
    android:id="@+id/textInputLayout"
    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    >
    <android.support.design.widget.TextInputEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:hint="hint2"
        />
</android.support.design.widget.TextInputLayout>

Я использую com.android.support:design:28.0.0.

Есть какие-нибудь идеи для реализации центрированного нормального вида TextInputEditText?

1 Ответ

0 голосов
/ 30 ноября 2018

Центрированный текст внутри выделенного текстового поля на самом деле не тот случай, который мы поддерживаем.На самом деле это вообще не упоминается в руководстве (https://material.io/design/components/text-fields.html)

Это похоже на ошибку, что текст метки центрируется, когда применяется центр тяжести. Самый простой способ исправить это - отправить сообщениенам с исправлением на https://github.com/material-components/material-components-android. Или вы можете отправить сообщение об ошибке здесь: https://issuetracker.google.com/issues/new?component=439535.

...