zoukankan      html  css  js  c++  java
  • AutoCompleteTextView之提醒输入和MultiAutoCompleteTextView分隔提醒输入

    首先是布局:

    <AutoCompleteTextView
    android:id="@+id/acTextview"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:singleLine="true"
    android:hint="请输入你要输入的关键字" >

    <requestFocus />
    </AutoCompleteTextView>

        <MultiAutoCompleteTextView
            android:id="@+id/multiAutoCompleteTextView1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_below="@+id/acTextview"
            android:layout_marginTop="18dp"
            android:hint="请输入提示文字" />
    

      

    然后就是在src中添加代码:

     1 public class MainActivity extends Activity {
     2     private AutoCompleteTextView acTextview;
     3     private String[]res={"beijing","shenzhen","shanghai"};
     4     @Override
     5     protected void onCreate(Bundle savedInstanceState) {
     6         super.onCreate(savedInstanceState);
     7         setContentView(R.layout.activity_main);
     8         acTextview=(AutoCompleteTextView)findViewById(R.id.acTextview);
     9         ArrayAdapter<String> adapter=new ArrayAdapter<String>(MainActivity.this, android.R.layout.simple_list_item_1,res);
    10         acTextview.setAdapter(adapter);
    11     }
    macTextview.setAdapter(adapter);
    macTextview.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());

      

    by:慕课网

  • 相关阅读:
    vue+element ui 实现菜单无限极菜单
    DOM事件绑定原理和传播机制
    数组和对象的深浅克隆
    new源码分析和Object.create的重写
    原型和原型链的学习
    4.3 模型参数的延后初始化
    4.2 模型参数的访问、初始化和共享
    CSAPP Float Point
    4.1 模型构造
    3.16 实战Kaggle比赛:房价预测
  • 原文地址:https://www.cnblogs.com/anylemons/p/6716046.html
Copyright © 2011-2022 走看看