设为首页 加入收藏

TOP

Android学习之AutoCompleteTextView控件的学习(二)
2014-11-24 11:17:53 来源: 作者: 【 】 浏览:1
Tags:Android 习之 AutoCompleteTextView 控件 学习
d Miquelon", "Saint Vincent and the Grenadines",
"Samoa", "San Marino", "Saudi Arabia", "Senegal", "Seychelles",
"Sierra Leone", "Singapore", "Slovakia", "Slovenia",
"Solomon Islands", "Somalia", "South Africa",
"South Georgia and the South Sandwich Islands", "South Korea",
"Spain", "Sri Lanka", "Sudan", "Suriname",
"Svalbard and Jan Mayen", "Swaziland", "Sweden", "Switzerland",
"Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand",
"The Bahamas", "The Gambia", "Togo", "Tokelau", "Tonga",
"Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan",
"Turks and Caicos Islands", "Tuvalu", "Virgin Islands", "Uganda",
"Ukraine", "United Arab Emirates", "United Kingdom",
"United States", "United States Minor Outlying Islands", "Uruguay",
"Uzbekistan", "Vanuatu", "Vatican City", "Venezuela", "Vietnam",
"Wallis and Futuna", "Western Sahara", "Yemen", "Yugoslavia",
"Zambia", "Zimbabwe"
};


@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
actv = (AutoCompleteTextView) findViewById(R.id.actv);
textView = (TextView) findViewById(R.id.textView);


/**
* 调用ArrayAdapter的构造函数创建一个ArrayAdapter对象
* 第一个参数指上下文
* 第二个参数指定了下拉菜单中每一个条目的样式
* 第三个参数指定了TextView控件的id
* 第四个参数要添加数据的集合,为整个列表提供数据
*/
ArrayAdapter aa = new ArrayAdapter(this, R.layout.list_item, R.id.textView, str);
actv.setAdapter(aa);
}
}


首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Android DatePicker控件的使用 下一篇Android入门之ExpandableListView..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·Redis on AWS:Elast (2025-12-27 04:19:30)
·在 Spring Boot 项目 (2025-12-27 04:19:27)
·使用华为开发者空间 (2025-12-27 04:19:24)
·Getting Started wit (2025-12-27 03:49:24)
·Ubuntu 上最好用的中 (2025-12-27 03:49:20)