Как отцентрировать прорисовку по вертикали в TextInputLayout? - PullRequest
0 голосов
/ 18 октября 2019

Я добавил drawable в левой части TextInputLayout (как видно из TextInputEditText ниже) и хочу добавить несколько отступов под ним так, чтобы они стали центрироваться вертикально внутри своего родителя. Для этого есть команда или обходной путь?

<com.google.android.material.textfield.TextInputLayout
                android:id="@+id/contact_first_name_input_text"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:hint="@string/contact_first_name"
                android:layout_marginEnd="8dp">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/contactFirstName"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="textPersonName|textCapWords"
                    android:drawableStart="@drawable/ic_person_black_24dp"
                    android:drawablePadding="8dp"
                    />

1 Ответ

0 голосов
/ 18 октября 2019

Используйте атрибут app:startIconDrawable в вашем TextInputLayout, чтобы добавить отрисовку:

<com.google.android.material.textfield.TextInputLayout
       app:startIconDrawable="@drawable/..."

enter image description hereenter image description here

...