ave different input requirements. When in doubt about the
* behavior you should adopt for a particular call, please mimic the
* default TextView implementation in the latest Android version, and
* if you decide to drift from it, please consider carefully that
* inconsistencies in text edition behavior is almost universally felt
* as a bad thing by users.
*假如你实现了自己的编辑器,你就需要提供你自己实现的BaseInputConnection子类实例,此实例用于和输入法应用程序保持应答。
确保你的控件通过了大部分输入法的测试,因为他们的行为变化多端。同时确保在多语言下进行测试,包括CJK或者从右到左的语言,例如arabic。因为这些语言有很多不同的输入要求。
当你对实现的控件的行为存有疑问时,你可以通话我们,或者模仿最近的android版本的TextView实现。假如你确定在你的
系统中使用它,请考虑清楚控件的文字输入可能让用户体验很坏。
*
Cursors, selections and compositions
*
In Android, the cursor and the selection are one and the same
* thing. A "cursor" is just the special case of a zero-sized
* selection. As such, this documentation uses them
* interchangeably. Any method acting "before the cursor" would act
* before the start of the selection if there is one, and any method
* acting "after the cursor" would act after the end of the
* selection.
*在android中,光标和所选内容一件事。光标就是一个0内容的所选内容。因而在android中,他们可以互换。
任何方法提交在光标前行为就是在提交所选内容之前,同理,在光标之后,就是提交在所选内容之后一样的行为。
*
An editor needs to be able to keep track of a currently
* "composing" region, like the standard edition widgets do. The
* composition is marked in a specific style: see
* {@link android.text.Spanned#SPAN_COMPOSING}. IMEs use this to help
* the user keep track of what part of the text they are currently
* focusing on, and interact with the editor using
* {@link InputConnection#setComposingText(CharSequence, int)},
* {@link InputConnection#setComposingRegion(int, int)} and
* {@link InputConnection#finishComposingText()}.
* The composing region and the selection are completely independent
* of each other, and the IME may use them however they see fit.
*/
编辑器控件需要能够保持写作内容区域的能力,就像标准的编辑小部件一样。
写作区域会被应用特定样式,例如:android.text.Spanned#SPAN_COMPOSING,输入法使用这样来帮助用户保持和当前获取焦点的文字内容追踪的能力,通过setComposingText或者finishComposingText等方法。