android-AutoCompleteTextView使用

来源:互联网 发布:mac如何导出iphone照片 编辑:程序博客网 时间:2024/05/23 21:49

可以设置下拉布局,以及显示位置:

    <AutoCompleteTextView

        android:id="@+id/comm_auto_edit"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_margin="20dp"
        android:completionThreshold="1"
        android:dropDownAnchor="@id/comm_edit"//显示在那个布局下面
        android:dropDownHeight="fill_parent"
        android:dropDownWidth="fill_parent" />
    <!-- android默认的是至少输入2个字符才显示提示  , -->

    <!-- android:completionThreshold   用来可以修改默认值 -->


ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),
                R.layout.auto_list_item, COUNTRIES);


参数2,设置布局,下拉布局设置,也可以使用提供的公用布局:android.R.layout.simple_dropdown_item_1line


0 0