博客:http://blog.csdn.net/muyang_ren
XML就不说了
Java代码
public class LoginActivity extends Activity {
private AutoCompleteTextView autoIpText;
private ArrayAdapter<String> arrayAdapter;
private List<String> IPs;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
IPs = new ArrayList();
IPs.add("192.168.7.106");//预览添加一个字符串
//事件源处理
autoIpText = (AutoCompleteTextView)findViewById(R.id.autoIpText);
//适配器设置
arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,IPs);
autoIpText.setAdapter(arrayAdapter);
}
......
}