AutoCompleteTextView Control for Android Development
AutoCompleteTextView is an editable text that automatically displays and selects a string that matches the user's input string and its position.
Several methods are introduced: <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + signature + CjxwPtfUtq/samples/Signature + signature + ss7K/c6q19a3 + signature + 77f09DGpcXkz + signature + uMPM4cq + signature + v/Signature + PGJyPgo8L3A + signature + TWFpbkFjdGl2aXR5LmphdmE8YnI + cda-vcd4kpha + PHByZSBjbGFzcz0 = "brush: java; "> public class MainActivity extends Activity {AutoCompleteTextView autoCompleteTextView; String [] str = {" peach "," Pear "," Banana "," honeydew "," orange ", "tangerine"}; @ Overridepublic void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); setContentView (R. layout. activity_main); autoCompleteTextView = (AutoCompleteTextView) findViewById (R. id. myview); ArrayAdapter ArrayAdapter = new ArrayAdapter (MainActivity. this, android. r. layout. simple_dropdown_item_1line, str); // match autoCompleteTextView after 3 characters in length. setThreshold (3); // The prompt message autoCompleteTextView. setCompletionHint ("select one"); // background autoCompleteTextView. setDropDownBackgroundResource (R. drawable. blue); // autoCompleteTextView. setDropDownBackgroundDrawable (d) autoCompleteTextView. setAdapter (arrayAdapter );}}
Activity_main.xml
: