Preface
This chapter covers Android. widget. multiautocompletetextview. The translation is from Ying Ge er. Thank you again! I look forward to your participation in Android API Chinese translation, contact me over140@gmail.com.
Statement
You are welcome to repost, but please keep the original source of the article :)
Blog Garden: http://www.cnblogs.com/
Android Chinese translation group: http://www.cnblogs.com/over140/
Body
I. Structure
Public class multiautocompletetextview extends autocompletetextview
Java. Lang. Object
Android. View. View
Android. widget. textview
Android. widget. edittext
Android. widget. autocompletetextview
Android. widget. multiautocompletetextview
Ii. Category Overview
An inherited fromAutoCompleteTextView
Of
The editable text view effectively expands the text you type without entering the entire content. (If you enter a part of the content, the system will prompt the remaining part of the content ).
The user must provideMultiAutoCompleteTextView.Tokenizer
To distinguish different substrings.
The following code snippet shows how to create a text view. This view is used to effectively add a prompt to the country name entered by the user.
Iii. Public Methods
Public Boolean enoughtofilter ()
This method does not check when the total length of the text exceeds the predefined value, but only when the findtokenstart () function to getselectionend () the function takes effect only when the text length is 0 or exceeds the predefined value. (Translator's note: filtering when the text length exceeds the threshold)
Public void validate mvalidation ()
This subclass method is not used to determine the validity of the entire text, but to determine the validity of a single symbol in the text. The empty tag will be removed.
Public void settokenizer (multiautocompletetextview. tokenizer T)
Specifies the word segmentation component used to determine the range of text input.
Iv. Protected Methods
Protected void extends mfiltering (charsequence text, int keycode)
This method does not filter the content of the entire edit box. It only filters text content that is obtained from the findtokenstart () function to the getselectionend () function and has a length of 0 or exceeds the predefined value.
Parameters
Text specifies the filtering Mode
The keycode is inserted into the last character in the editing box. When the character (text) is input through a soft keyboard, be careful that the value of this character may be null.
Protected void extends mfiltering (charsequence text, int start, int end, int keycode)
Start filtering the drop-down list content. The filtering mode is the specified range in the editing box. Subclass can override this method to use a different pattern.
Protected void replacetext (charsequence text)
Replace the text range obtained from the findtokenstart () function to the getselectionend () function and the results returned by the text version passed to the terminatetoken () function to implement text input. In addition, the text replacement area will be marked as the automatic renewal area, so that if you press the Del key directly, the execution will stop. Subclass can override this method to implement many different text insertion tasks.
Parameters
Selected items in the text drop-down list
5. Supplement
5.1 related articles
Android control: Exploring autocompletetextview and multiautocompletetextview
Autocompletetextview and multiautocompletetextview
Auto complete text
End
The picture in the article is in Article 3. You can also find the code from the three articles. You are welcome to provide suggestions.