zoukankan      html  css  js  c++  java
  • Android实现多个词汇连续输入的提示

     <MultiAutoCompleteTextView
            android:id="@+id/mulauto"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
    java:
    package com.just;
     
    import android.os.Bundle;
    import android.app.Activity;
    import android.widget.ArrayAdapter;
    import android.widget.AutoCompleteTextView;
    import android.widget.MultiAutoCompleteTextView;
     
    public class MainActivity extends Activity {
     
            private static final String[] autostr = new String[] { "Italy" , "IT" ,
                          "item", "its" , "itseif" };
     
            @Override
            protected void onCreate(Bundle savedInstanceState) {
                   super.onCreate(savedInstanceState);
                  setContentView(R.layout. activity_main);
                  ArrayAdapter<?> adapter = new ArrayAdapter<Object>(this,
                               android.R.layout. simple_dropdown_item_1line, autostr );
           
     
                  MultiAutoCompleteTextView multview = (MultiAutoCompleteTextView) findViewById(R.id.mulauto );
                  multview.setAdapter(adapter);
                  multview.setTokenizer( new MultiAutoCompleteTextView.CommaTokenizer());
           }
     
    }
    与之前的实现不同的是在实现选择输入的还要设置一个分词方式(Tokenizer);
  • 相关阅读:
    RA-Embedding-based Retrieval in Facebook Search
    RA-Recommending What Video to Watch Next: A Multitask Ranking System
    家事杂谈-2
    工作体会-3
    CCS
    CCS
    CCS
    CCS
    CCS
    CCS
  • 原文地址:https://www.cnblogs.com/cwr941012/p/4909986.html
Copyright © 2011-2022 走看看