android 控件 自动提示(AutoCompleteTextView)
16lz
2021-01-26
1、继承关系和子类:
2、定义:
An editable text view that shows completion suggestions automatically while the user is typing. The list of suggestions is displayed in a drop down menu from which the user can choose an item to replace the content of the edit box with.
自动完成的文本视图
3、XML重要属性:
5、实战:
布局文件
java代码 package com.example.autocompletetextviewdemo;import android.os.Bundle;import android.support.v7.app.ActionBarActivity;import android.widget.ArrayAdapter;import android.widget.AutoCompleteTextView;public class MainActivity extends ActionBarActivity {private static final String[] COUNTRIES = new String[] { "111", "222","3343", "444", "5555" };@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);ArrayAdapter adapter = new ArrayAdapter(this,android.R.layout.simple_dropdown_item_1line, COUNTRIES);AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.autoText);textView.setAdapter(adapter);}}
参考1: http://developer.android.com/intl/zh-cn/reference/android/widget/AutoCompleteTextView.html 参考2: http://blog.csdn.net/iamkila/article/details/7230160
更多相关文章
- view page 布局tab
- Android(安卓)AlertDialog
- 关于 getViewTreeObserver
- 简单适配器加载列表
- Android(安卓)ViewPager 的简单应用
- android 将一个上下文菜单列表视图
- Fragment嵌套时注意点
- Android(安卓)TextView中文本点击文字跳转
- AndroidStudio:Could not GET 'https://dl.google.com Received