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.
Try this sample code. It fits your requirement.
PopupWindow pw = new PopupWindow(
this.getViewInflate().inflate(R.layout.pw_layout,
null, true, null),
100,100,true);
// display the popup in the center
pw.showAtLocation(layout, Gravity.CENTER, 0, 0);
pw.update(20,20,100,100);
For the views inside EditText
part, you 'll have to extend the EditText
. Overview of how it should look is as follows.
class emailEditText extends EditText {
List<NamePhotoView> ViewlistOfSelectedContacts; // create new
void addContact(String name, Bitmap photo) {
// create a new 'NamePhotoView' and add to the ViewlistOfSelectedContacts
}
@Override
void onDraw(Canvas canvas) {
for (....) {
// draw all views from the list. left to right.
}
// you have to some how offset the text start coordinate. then call super
super.onDraw(canvas);
}
}
I think you cannot set TextView
inside EditText
.
But alternatively you can make it look that way. Here are the steps
BitmapDrawable
SpanableString
(ImageSpan
)SpannableString
to your EditText
I have recently completed this kind of ui and i have explained in my blog Making GoSmsPro/Evernote like EditText
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With