-1

I have the following layout:

enter image description here

I want to set a drawable inside my textedit, something like this:

enter image description here

The problem comes when I go to my EditText and I try to set android:drawableEnd="@drawable/money", this happens:

enter image description here

How can I adjust this drawable?

Lechucico
  • 1,914
  • 7
  • 27
  • 60
  • use this and resize your icon. https://romannurik.github.io/AndroidAssetStudio/icons-actionbar.html#source.type=clipart&source.clipart=add_circle&source.space.trim=0&source.space.pad=0&name=ic_action_add_circle&theme=light&color=rgba(33%2C%20150%2C%20243%2C%200.6) – karan Mar 22 '19 at 10:22
  • check this [link](https://stackoverflow.com/questions/7538021/how-can-i-shrink-the-drawable-on-a-button) , it should fix your problem – Ahmad Sabeh Mar 22 '19 at 10:23
  • @Ahmad I've implemented this and happens the same. – Lechucico Mar 22 '19 at 10:25
  • @KaranMer This page is amazing but it only generates on black, white or a single color. – Lechucico Mar 22 '19 at 10:32
  • you can use your image, select it from option next to clipart – karan Mar 22 '19 at 10:36

1 Answers1

0

Try this way

<?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>

OUTPUT

enter image description here

AskNilesh
  • 67,701
  • 16
  • 123
  • 163