标签:
用于自动补全内容
适应器可用于显示多行内容
1 package com.supermario.autocompletedemo; 2 import android.app.Activity; 3 import android.os.Bundle; 4 import android.widget.ArrayAdapter; 5 import android.widget.AutoCompleteTextView; 6 public class AutoCompleteDemo extends Activity { 7 //创建一个字符串数组,用于为adapter提供数据来源 8 String GAME[]=new String[]{"game1","gam2","gamm3","gamek3"}; 9 @Override 10 public void onCreate(Bundle savedInstanceState) { 11 super.onCreate(savedInstanceState); 12 setContentView(R.layout.main); 13 AutoCompleteTextView auto=(AutoCompleteTextView)findViewById(R.id.autoCompleteTextView1); 14 //吸纳进数组适配器adapter,绑定数据,设定界面为R.layout.list_view 15 ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,R.layout.list_view,GAME); 16 //为AutoCompleteTextView设定适配器 17 auto.setAdapter(adapter); 18 } 19 }
Android 笔记 AutoCompleteTextView day8
标签:
原文地址:http://www.cnblogs.com/cnblogs321114287/p/5157878.html