directory search
android Manifest Manifest.permission Manifest.permission_group android.accessibilityservice AccessibilityService android.accounts Account android.app NotificationManager android.bluetooth BluetoothAdapter BluetoothClass BluetoothClass.Device BluetoothClass.Device.Major BluetoothClass.Service BluetoothDevice BluetoothServerSocket BluetoothSocket android.content SharedPreferences android.database.sqlite SQLiteCursorDriver SQLiteOpenHelper android.graphics Bitmap android.location LocationListener Geocoder GpsStatus GpsStatus.Listener GpsStatus.NmeaListener GpsSatellite android.media AudioFormat AsyncPlayer AudioRecord AudioRecord.OnRecordPositionUpdateListener ThumbnailUtils AudioManager android.net TrafficStats MailTo LocalSocket android.os AsyncTask AsyncTask.Status CountDownTimer Message MessageQueue HandlerThread android.text Html android.util JsonWriter android.view ContextMenu ContextMenu.ContextMenuInfo Display ViewManager View ViewStub ViewTreeObserver ViewParent WindowManager GestureDetector Gravity MenuInflater ScaleGestureDetector SoundEffectConstants android.view.inputmethod InputConnection InputMethod InputMethodSession BaseInputConnection InputMethodManager android.widget AbsListView AbsListView.LayoutParams AbsListView.OnScrollListener AbsListView.RecyclerListener AbsoluteLayout AbsoluteLayout.LayoutParams AbsSeekBar AbsSpinner AdapterView AdapterView.AdapterContextMenuInfo AdapterView.OnItemLongClickListener AdapterView.OnItemSelectedListener AdapterView.OnItemClickListener AnalogClock BaseAdapter BaseExpandableListAdapter Button CheckBox CheckedTextView Checkable Chronometer Chronometer.OnChronometerTickListener CompoundButton CompoundButton.OnCheckedChangeListener CursorAdapter CursorTreeAdapter DatePicker DatePicker.OnDateChangedListener DialerFilter DigitalClock EditText Filter Filter.FilterListener Filter.FilterResults ExpandableListAdapter ExpandableListView.OnChildClickListener ExpandableListView.OnGroupClickListener ExpandableListView.OnGroupCollapseListener ExpandableListView.OnGroupExpandListener Filterable Gallery Gallery.LayoutParams GridView GridLayout GridLayout.Alignment RadioGroup ImageView ImageView.ScaleType HorizontalScrollView ImageButton ImageSwitcher FilterQueryProvider ListAdapter ListView MediaController MultiAutoCompleteTextView MultiAutoCompleteTextView.CommaTokenizer MultiAutoCompleteTextView.Tokenizer QuickContactBadge RadioButton RatingBar RatingBar.OnRatingBarChangeListener RelativeLayout RemoteViews ResourceCursorAdapter ResourceCursorTreeAdapter Scroller ScrollView SearchView SearchView.OnCloseListener SearchView.OnQueryTextListener SearchView.OnSuggestionListener SeekBar SeekBar.OnSeekBarChangeListener SimpleAdapter SimpleAdapter.ViewBinder SimpleCursorAdapter SimpleCursorAdapter.CursorToStringConverter SimpleCursorAdapter.ViewBinder SimpleCursorTreeAdapter SimpleCursorTreeAdapter.ViewBinder SimpleExpandableListAdapter SlidingDrawer SlidingDrawer.OnDrawerCloseListener SlidingDrawer.OnDrawerOpenListener SlidingDrawer.OnDrawerScrollListener Spinner SpinnerAdapter WrapperListAdapter TabHost TabHost.TabSpec TextView TimePicker TimePicker.OnTimeChangedListener Toast TableLayout TableLayout.LayoutParams TableRow TableRow.LayoutParams TabWidget TextSwitcher ToggleButton TwoLineListItem VideoView ViewAnimator ViewFlipper ViewSwitcher ViewSwitcher.ViewFactory ZoomButtonsController ZoomButtonsController.OnZoomListener ZoomButton ZoomControls dalvik.system DexFile
characters


MultiAutoCompleteTextView

颖哥儿

版本:Android 2.2 r1

 

public class MultiAutoCompleteTextView extends AutoCompleteTextView

 

java.lang.Object

android.view.View

       android.widget.TextView

              android.widget.EditText

                     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控件之AutoCompleteTextViewMultiAutoCompleteTextView探究

AutoCompleteTextViewMultiAutoCompleteTextView

Auto Complete Text


Previous article: Next article: