0

As we all know that we can set a drawable_left on the EditText using

edittext.setcCompoundDrawablesWithIntrinsicBounds(R.drawable.icon,0,0,0);

Is it possible to set a non editable text say "A" on the left side of the edit text?

Vishwajit Palankar
  • 3,033
  • 3
  • 28
  • 48
Asif Sb
  • 785
  • 9
  • 38

1 Answers1

2

You can do this like this (The values are for example):

<RelativeLayout android:layout_width="wrap_content"
                android:layout_height="wrap_content">
    <TextView android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="A"
              android:layout_marginRight="10dp"/>
    <EditText android:layout_width="100dp"
              android:layout_height="25dp"
              android:id="@+id/editTextView"
              android:layout_marginLeft="40dp"/>
</RelativeLayout>
Gabriella Angelova
  • 2,985
  • 1
  • 17
  • 30
  • Then try with this one http://stackoverflow.com/questions/19788386/set-unchangeable-some-part-of-edittext-android/19789317#19789317 - Convert the text to a drawable and paste it into the editText – Gabriella Angelova May 13 '15 at 07:29