I am trying to insert a textview inside a Edittext as in below
can anyone pls give me ideas about how to implement it or something.
thanks :)
update: the textviews in the edittext will vary dynamically.
I am trying to insert a textview inside a Edittext as in below
can anyone pls give me ideas about how to implement it or something.
thanks :)
update: the textviews in the edittext will vary dynamically.
I think you cannot set
TextView
insideEditText
. But alternatively you can make it look that way. Here are the stepsBitmapDrawable
SpanableString
(ImageSpan
)SpannableString
to yourEditText
I have recently completed this kind of ui and i have explained in my blog Making GoSmsPro/Evernote like EditText
you can create a component based on what you need like you mentioned above with frame layout. You may have a FrameLayout or RelativeLayout with two views such as EditText and TextView while text view is on top of EditText. also you can put image view if you want in right like your picture.
Although you don't need to create a component and easily you can do this in your XML layout, if you have plan to use it regularly through your application it is good practice to create those views as a component.
The way Android implements it, the so called Chips UI, can be found here.
Essentially it's a custom
span
that draws the components (image, text, etc.) over the text, plus some logic to show the popup.Try this sample code. It fits your requirement.
For the views inside
EditText
part, you 'll have to extend theEditText
. Overview of how it should look is as follows.