Android7.0中文文档(API)--- AutoCompleteTextView

完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/AutoCompleteTextView.html

AutoCompleteTextView

public class AutoCompleteTextView
extends EditText implements Filter.FilterListener

java.lang.Object
   ↳android.view.View
    ↳android.widget.TextView
     ↳android.widget.EditText
      ↳android.widget.AutoCompleteTextView
已知的间接子类


An editable text view that shows completion suggestions automatically while the user is typing. The list of suggestions is displayed in a drop down menu from which the user can choose an item to replace the content of the edit box with.
一个可编辑的文本视图,在用户输入时自动显示补全建议提示。建议列表显示在一个下拉菜单中,用户可以从中选择一项来替换编辑框中的内容。

The drop down can be dismissed at any time by pressing the back key or, if no item is selected in the drop down, by pressing the enter/dpad center key.
通过按下back按钮,或者没有在下拉菜单中选择项而按下了enter/dpad的中间按键,都可以在任何时候关闭下拉菜单。

The list of suggestions is obtained from a data adapter and appears only after a given number of characters defined by the threshold.
建议列表的内容是从数据适配器中获取的,并且只在the threshold定义的指定字符数之后才出现。

The following code snippet shows how to create a text view which suggests various countries names while the user is typing:
下面的代码片段展示了如何创建一个文本视图,该视图在用户输入时显示不同的国家名称:

public class CountriesActivity extends Activity { protected void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.countries); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, COUNTRIES); AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.countries_list); textView.setAdapter(adapter); } private static final String[] COUNTRIES = new String[] { "Belgium", "France", "Italy", "Germany", "Spain" }; }

See the Text Fields guide.
请参考Text Fields指南。

摘要


嵌套类

interfaceAutoCompleteTextView.OnDismissListener

Listener to respond to the AutoCompleteTextView's completion list being dismissed. 
监听器,用于监听AutoCompleteTextView的补全列表的关闭事件。 

interfaceAutoCompleteTextView.Validator

This interface is used to make sure that the text entered in this TextView complies to a certain format. 
此接口用于确保在此TextView中输入的文本符合某种格式。 

XML属性

android:completionHint设定下拉菜单中显示的提示。 
android:completionHintView设定下拉菜单中显示的提示视图。 
android:completionThreshold用户在下拉菜单里,显示完整建议之前,必须输入的字符数。 
android:dropDownAnchor自动完成的下拉的参考视图。 
android:dropDownHeight下拉菜单的高度。 
android:dropDownHorizontalOffset下拉菜单水平偏移的像素数量。 
android:dropDownSelector下拉菜单列表的选择器(Selector)样式。 
android:dropDownVerticalOffset下拉菜单垂直偏移的像素数量。 
android:dropDownWidth下拉菜单的宽度。 
android:popupBackground弹出窗口的背景。 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值