android 中的自动提示框
来源:互联网 发布:red flag linux 编辑:程序博客网 时间:2024/05/17 02:14
无聊没事 随便写写= =,
自动提示框 用的蛮多的。
public class MainActivity extends Activity { /**继承于 EditView * 支持单个关键字自动查询,继续输入其他关键字会覆盖现有的 */ private AutoCompleteTextView autoCompleteTextView; /**继承于AutoCompleteTextView * 支持多个关键字自动查询 */ private MultiAutoCompleteTextView multiAutoCompleteTextView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); autoCompleteTextView = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView); /** 设置下拉列表的高度 宽度 autoCompleteTextView.setDropDownHeight(20); autoCompleteTextView.setDropDownWidth(20); 清除选中的列表项 autoCompleteTextView.clearListSelection(); 关闭下拉菜单 autoCompleteTextView.dismissDropDown(); 设置下拉列表的背景 autoCompleteTextView.setBackgroundResource(resid) */ //设置输入多少字符后提示,默认值为2 autoCompleteTextView.setThreshold(1); autoCompleteTextView.setCompletionHint("aaaaa"); //下拉列表提示标题 //造假数据 这个你可以从 SharedPreferences 或者 数据库中 取数据 String[] autoStrings = new String[]{"水果", "水果忍者", "水果游戏", "火影忍者", "gogo"}; ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, autoStrings); autoCompleteTextView.setAdapter(adapter); multiAutoCompleteTextView = (MultiAutoCompleteTextView) findViewById(R.id.multiAutoCompleteTextView); //performValidation():代替验证整个文本 //用户必须提供一个MultiAutoCompleteTextView.Tokenizer用来区分不同的子串。 multiAutoCompleteTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer()); multiAutoCompleteTextView.setThreshold(1); multiAutoCompleteTextView.setAdapter(adapter); multiAutoCompleteTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer()); }}
- android 中的自动提示框
- android中的自动提示框AutoCompleteTextView
- Android 自动提示框
- android设置eclipse中的自动提示功能
- Android开发自动提示框
- android自动提示输入框
- Android中的提示框
- Android中ArrayAdapter在自动提示文本中的使用
- [Android基础]增强eclipse中的自动提示功能
- Android中的多选框,提示框
- Android中的弹出提示框
- Android中的弹出提示框
- Android中的弹出提示框
- 【Android】EditText输入框自动提示
- 【Android】EditText输入框自动提示
- android自动提示框AutoCompleteTextView和MultiAutoCompleteTextView
- android-autoComplete 自动提示
- android 自动提示组件
- LINUX mac地址的修改
- MySQL主从同步原理+部署
- 文件过滤驱动Sfilter学习笔记
- 算法
- 优先队列
- android 中的自动提示框
- How to assign the different php files
- cocos2d-x CCMenu 菜单
- 黑马程序员之其他对象(System,Date,Calendar)
- Ubuntu打开doc和ppt等文件的方法
- pku3517(约瑟夫环)
- 主从同步出现一下错误:Slave_IO_Running: Connecting
- Problem B: 评委打分
- CV人物志