简体   繁体   English

在电子邮件撰写中,我想要为android中的yahoo like功能设计输入

[英]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, 所以我认为解决方案是

  1. User enters email id and hits SPACE or COMMA. 用户输入电子邮件ID,然后点击SPACE或COMMA。
  2. then one rectangular box should appear on background. 那么一个矩形框应出现在背景上。
  3. I want an cross mark on right corner of that rectangular box. 我想要在该矩形框的右上角有一个十字标记。
  4. If user want to delete that 3rd email id,then he will just tap on cross mark of 3rd rectangle which contains that email id. 如果用户要删除该第三电子邮件ID,则只需点击包含该电子邮件ID的第三矩形的十字标记。

(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: 建议的攻击计划:

  1. Add a TextWatcher to your EditText so you know when the text changes. TextWatcher添加到您的EditText以便您知道文本何时更改。
  2. Each time the text changes, scan the contents for anything matching an email address (suggest you use regex for this). 每次文本更改时,都要在内容中扫描与电子邮件地址匹配的任何内容(建议您为此使用正则表达式)。
  3. For each matched email address, generate a Bitmap equivalent using standard drawing APIs (ie create Canvas , measure text, draw background, draw text). 对于每个匹配的电子邮件地址,使用标准绘图API(即创建Canvas ,测量文本,绘制背景,绘制文本)生成等效的Bitmap
  4. Instantiate an ImageSpan (this is kinda the key to the whole thing) using your bitmap as the constructor argument. 使用位图作为构造函数参数实例化ImageSpan (这是整个过程的关键)。
  5. Replace the email address in the text with a single space character (say) and call setSpan() on that single character to have your ImageSpan replace it's appearance. 单个空格字符(例如) 替换文本中的电子邮件地址,然后对该单个字符调用setSpan() ,以使ImageSpan替换其外观。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM