[英]In Email compose, I want design inputs for yahoo like feature in android
In Email compose, when user types/selects email ids in to/cc/bcc. 在“电子邮件撰写”中,当用户在/ cc / bcc中键入/选择电子邮件ID时。 Suppose there are 7-8 email ids and now user want to delete 3rd one. 假设有7-8个电子邮件ID,现在用户要删除第三个。 It is very difficult for user to go to 3rd one and delete that one. 用户很难转到第三个并删除该一个。 So I think solution for this is, 所以我认为解决方案是
(please refer figure below from Yahoo email composer) (请从Yahoo电子邮件编辑器中参考下图)
I need similar functionality. 我需要类似的功能。 How can I achieve in android? 如何在android中实现? Is there any standard component I can use? 我可以使用任何标准组件吗? Currently I am using auto complete text view for To, Cc, Bcc. 目前,我正在使用To,Cc,Bcc的自动完成文本视图。 Please help. 请帮忙。 Thank you in advance. 先感谢您。
I don't have time to write up working code, but I will point you in the right direction. 我没有时间编写有效的代码,但我会为您指明正确的方向。 The key for doing funky things with text in standard components like EditText
are called "spans". 在诸如EditText
类的标准组件中使用文本执行时髦操作的关键称为“跨度”。
Suggested plan of attack: 建议的攻击计划:
TextWatcher
to your EditText
so you know when the text changes. 将TextWatcher
添加到您的EditText
以便您知道文本何时更改。 Bitmap
equivalent using standard drawing APIs (ie create Canvas
, measure text, draw background, draw text). 对于每个匹配的电子邮件地址,使用标准绘图API(即创建Canvas
,测量文本,绘制背景,绘制文本)生成等效的Bitmap
。 ImageSpan
(this is kinda the key to the whole thing) using your bitmap as the constructor argument. 使用位图作为构造函数参数实例化ImageSpan
(这是整个过程的关键)。 setSpan()
on that single character to have your ImageSpan
replace it's appearance. 用单个空格字符(例如) 替换文本中的电子邮件地址,然后对该单个字符调用setSpan()
,以使ImageSpan
替换其外观。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.