3

Как можно добавить иконку в поле вводе EditText, Пример:

введите сюда описание изображения

Исходник:

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignWithParentIfMissing="false"
    android:layout_centerHorizontal="true"
    android:layout_toRightOf="@+id/imageMode"
    style="@style/Base.Theme.AppCompat.Light"
    android:paddingBottom="10dp"
    android:layout_marginLeft="48dp"
    android:layout_marginRight="48dp">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Пароль"
        android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
0

1 ответ 1

7

Самый простой вариант - это добавить к EditText такую строчку:

<EditText
    ...
    android:drawableLeft="@drawable/my_icon"
    ...
/>

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.