- android
- android.accessibilityservice
- android.accounts
- android.content
- android.database.sqlite
- android.graphics
- android.location
- android.media
- android.net
- android.os
- android.text
- android.view
- android.view.inputmethod
- android.widget
- AbsListView
- AbsoluteLayout
- AbsSeekBar
- AbsSpinner
- AdapterView
- AnalogClock
- BaseAdapter
- BaseExpandableListAdapter
- Button
- CheckBox
- CheckedTextView
- Checkable
- Chronometer
- CompoundButton
- CursorAdapter
- CursorTreeAdapter
- DatePicker
- DialerFilter
- DigitalClock
- EditText
- Filter
- Filter.FilterListener
- Filter.FilterResults
- ExpandableListAdapter
- Filterable
- Gallery
- Gallery.LayoutParams
- GridView
- GridLayout
- RadioGroup
- ImageView
- HorizontalScrollView
- ImageButton
- ImageSwitcher
- FilterQueryProvider
- ListAdapter
- ListView
- MediaController
- QuickContactBadge
- RadioButton
- RatingBar
- RelativeLayout
- RemoteViews
- ResourceCursorAdapter
- ResourceCursorTreeAdapter
- Scroller
- ScrollView
- SearchView
- SeekBar
- SeekBar.OnSeekBarChangeListener
- SimpleAdapter
- SimpleCursorAdapter
- SimpleCursorTreeAdapter
- SimpleExpandableListAdapter
- SlidingDrawer
- Spinner
- SpinnerAdapter
- WrapperListAdapter
- TabHost
- TabHost.TabSpec
- TextView
- TimePicker
- Toast
- TableLayout
- TableRow
- TableRow.LayoutParams
- TabWidget
- TextSwitcher
- ToggleButton
- TwoLineListItem
- VideoView
- ViewAnimator
- ViewFlipper
- ViewSwitcher
- ZoomButtonsController
- ZoomButton
- ZoomControls
- dalvik.system
MultiAutoCompleteTextView
MultiAutoCompleteTextView
颖哥儿
版本:Android 2.2 r1
public class MultiAutoCompleteTextView extends AutoCompleteTextView
java.lang.Object
android.widget.AutoCompleteTextView
android.widget.MultiAutoCompleteTextView
概述
一个继承自 AutoCompleteTextView
的
可编辑的文本视图,能够对用户键入的文本进行有效地扩充提示,而不需要用户输入整个内容。(用户输入一部分内容,剩下的部分系统就会给予提示)。
用户必须提供一个 MultiAutoCompleteTextView.Tokenizer
以用来区分不同的子串。
下面的代码片段展示了如何创建一个文本视图,这个视图用来对用户输入的国家名称进行有效地补充提示。
公共方法
public boolean enoughToFilter ()
此方法并不是检验什么时候文本的总长度超过了预定的值,而是在仅当从函数 findTokenStart()到 getSelectionEnd() 函数得到的文本长度为 0 或者超过了预定值的时候才起作用。(译者注:当文本长度超过阈值时过滤)
public void performValidation ()
此子类方法并不是用来确定整个文本的有效性,而是用来确定文本中的单个符号的有效性。空标记将被移除。
public void setTokenizer (MultiAutoCompleteTextView.Tokenizer t)
设置用来决定用户正在输入文本的范围的分词组件。
受保护方法
protected void performFiltering (CharSequence text, int keyCode)
此方法并不过滤整个编辑框的内容,只是过滤从函数 findTokenStart() 到函数 getSelectionEnd() 获得的长度为 0 或者超过了预定的值的文本内容。
参数
text 指定过滤模式
keyCode 插入到编辑框中的最后一个字符;当字符(文本)是通过软键盘输入的时候,小心此字符的值可能为 NULL。
protected void performFiltering (CharSequence text, int start, int end, int keyCode)
启动对下拉式列表内容的过滤。过滤模式为编辑框中指定的范围。子类可覆盖此方法,以便于采用一个不同的模式。
protected void replaceText (CharSequence text)
通过替换从函数 findTokenStart() 到函数 getSelectionEnd() 得到的文本文本范围以及传递给函数 terminateToken() 的文版返回的结果来实现文本的输入。另外,文本的替换区域将会被标记为自动文本区,这样如果用户直接按 DEL 键,执行过程就会停止。子类可覆盖此方法来实现许多不同的文本插入工作。
参数
text 下拉列表里的选中项
补充
相关文章链接
Android 控件之 AutoCompleteTextView、MultiAutoCompleteTextView 探究
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论