Отрегулируйте Drawable, чтобы соответствовать в EditText - PullRequest
0 голосов
/ 22 марта 2019

У меня есть следующий макет:

enter image description here

Я хочу установить drawable внутри моего textedit, что-то вроде этого:

enter image description here

Проблема возникает, когда я захожу в свой EditText и пытаюсь установить android:drawableEnd="@drawable/money", это происходит:

enter image description here

Как мне отрегулировать этот чертеж?

1 Ответ

0 голосов
/ 22 марта 2019

Попробуйте следующим образом

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/round_textview_bg"
        android:gravity="center"
        android:layout_marginStart="20dp"
        android:layout_marginEnd="20dp"
        android:orientation="horizontal"
        android:padding="10dp">

        <ImageView
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:src="@drawable/image_info" />

        <EditText
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="@android:color/transparent"
            android:padding="5dp" />

        <ImageView
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:src="@drawable/image_info" />

    </LinearLayout>

</LinearLayout>

ВЫХОД

enter image description here

...