本例 1. Screen Top ,2. Screen Bottom , 3. Scroll 都是介绍AutoCompleteTextView 的用法,不同的是AutoCompleteTextView 中Layout 位置不同,可以看到 AutoCompleteTextView 根据其位置的不同自动为提示对话框会选择合适的位置在屏幕上显示。
在使用Google搜索时,Google 搜索项会随着用户输入自动给出相关提示,类AutoCompleteTextView 提供了类似的功能,在AutoCompleteTextView输入时,随着用户的输入,AutoCompleteTextView会显示一个提示列表可以供用户选择,用户可以使用Back 键随时取消这个提示框。
提示框的内容来自于一个Data Adapter ,并可以通过设定 threshold 给出用户输入超过几个字符后才出现提示框。
本例为提示框添加国家名称的提示:
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line,
COUNTRIES);
AutoCompleteTextView textView
= (AutoCompleteTextView) findViewById(R.id.edit);
textView.setAdapter(adapter);
...
static final String[] COUNTRIES = new String[] {
"Afghanistan", "Albania", "Algeria", "American Samoa",
"Andorra", "Angola", "Anguilla", "Antarctica",
"Antigua and Barbuda", "Argentina" ..
本例的AutoCompleteTextView 位置在屏幕的上部,可以看看提示框显示的位置:
分享到:
相关推荐
NULL 博文链接:https://kakukemeit.iteye.com/blog/1806388
android apidemos代码的示例解析,讲的挺全的
最新版ApiDemos Android SDK 中带有很多例子,其中ApiDemo 详细介绍了Android 平台主要API,分成了 · App · Content · Graphics · Media · OS · Text · Views 几个大类,每个大类又分为几个小类,...
Android ApiDemos apk, 包括Android presentation双屏异显 demon, App>Activity>Presentation
最新Android apidemos
demos :jdk-8u202-linux-arm64-vfp-hflt-demos.tar.gz
demos :jdk-8u202-linux-x64-demos.tar.gz
API Demos 是 Google 为了 Android 开发者所提供的一个 Android API 合集,其中包含了很多的 API 范例,同时遵循了良好的代码规范,是一个值得开发者研究和学习的典型。android的ApiDemos,需要解压缩后使用。
android APIdemos,android 源码简单使用demos
api ------------- API目录 demos ------------- 本地demos目录 lib ------------- 框架源代码目录 index.htm ------------- 主页面 loading.gif ------------- loading图标 welcome.htm ------------- 欢迎页面 ...
Tricks of the Windows video Game Programming<br><br>PART I Windows Programming Foundations 7<br>1 Journey into the Abyss 9<br>A Little History.............................................................
Centos7离线安装文件 jdk-8u231-linux-x64.tar.gz压缩包 免费下载,现在博客都是付费文件,搞得头大,现在免费分享
该Api Demos 源码是基于Android6.0 ,Eclipse下的,可以直接使用Android studio 导入工程即可。
demos :jdk-8u202-linux-arm32-vfp-hflt-demos.tar.gz
文件名称: jdk-8u231-solaris-x64-demos.tar.gz 文件大小: 8.43 MB (8,846,115 字节) MD5: 3b62803c4e86b40f1a83b68be7bce224 SHA1: 3aba5de2157163b949179a5b654494da05b4da9c SHA256: 774c5d41a1422d22d026eaaa39...
Android 系统原生应用API示例程序集合,是初学Android 开发的重要参考资料 https://github.com/longtaoge
<EhLib Archive> \ Demos \ DBVertGridEh.SimpleDemo \ Project1.dpr compiled project: <EhLib Archive> \ Demos \ Bin \ DBVertGridEh.SimpleDemo.Exe * There are changes in the grids inheritance tree: ...
<EhLib Archive> \ Demos \ DBVertGridEh.SimpleDemo \ Project1.dpr compiled project: <EhLib Archive> \ Demos \ Bin \ DBVertGridEh.SimpleDemo.Exe * There are changes in the grids inheritance tree: ...
Android官网ApiDemos源码 供大家学习参考之用
AndroidDemosStudio AndroidDemos ------- Android Studio