欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android實(shí)現(xiàn)動(dòng)態(tài)自動(dòng)匹配輸入的內(nèi)容

 更新時(shí)間:2018年08月10日 08:37:07   作者:流年若逝  
這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)動(dòng)態(tài)自動(dòng)匹配輸入的內(nèi)容,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了Android實(shí)現(xiàn)動(dòng)態(tài)自動(dòng)匹配輸入內(nèi)容的具體代碼,供大家參考,具體內(nèi)容如下

用這兩個(gè)控件

分別實(shí)現(xiàn)這兩個(gè):

package com.example.autocomplete;
 
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.MultiAutoCompleteTextView;
 
public class MainActivity extends Activity {
 private AutoCompleteTextView acTextView;
 private String[] res = {"xxz1","xxz2","xxz3","shanghai1","shanghai2"};
 
 
 private MultiAutoCompleteTextView MulacTextView;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    acTextView = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView1);
    
    //需要適配器
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,res);
    //初始數(shù)據(jù)源,去匹配文本框中輸入的內(nèi)容,然后綁定
    acTextView.setAdapter(adapter);
    
    MulacTextView = (MultiAutoCompleteTextView) findViewById(R.id.multiAutoCompleteTextView1);
    MulacTextView.setAdapter(adapter);
    //設(shè)置以逗號(hào)為分隔符結(jié)束的符號(hào)
    MulacTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    
   
}

布局文件:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical" >
 
  <AutoCompleteTextView
    android:hint="請(qǐng)輸入搜索的關(guān)鍵詞"
    android:completionThreshold="3"
    android:id="@+id/autoCompleteTextView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
     >
 
  </AutoCompleteTextView>
 
  <MultiAutoCompleteTextView
    android:hint="請(qǐng)輸入搜索的郵件關(guān)鍵詞"
    android:id="@+id/multiAutoCompleteTextView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >
    
  </MultiAutoCompleteTextView>
 
  <CheckBox
    android:id="@+id/checkBox1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="CheckBox" />
 
</LinearLayout>

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Android ADB常用命令總結(jié)

    Android ADB常用命令總結(jié)

    本文主要給大家分享的是一些我搜集的一些Android ADB(Android Debug Bridge)命令,在手動(dòng)或自動(dòng)構(gòu)建和測(cè)試過(guò)程中它們非常好用。希望大家能夠喜歡。
    2015-12-12
  • Android6.0藍(lán)牙出現(xiàn)無(wú)法掃描設(shè)備或閃退問(wèn)題解決辦法

    Android6.0藍(lán)牙出現(xiàn)無(wú)法掃描設(shè)備或閃退問(wèn)題解決辦法

    這篇文章主要介紹了Android6.0藍(lán)牙出現(xiàn)無(wú)法掃描設(shè)備或閃退問(wèn)題解決辦法的相關(guān)資料,需要的朋友可以參考下
    2017-02-02
  • 詳解Android安全防護(hù)之加密算法

    詳解Android安全防護(hù)之加密算法

    Android應(yīng)用對(duì)安全防范這方面要求越來(lái)越高了。特別是金融行業(yè),如果app沒(méi)有沒(méi)有做好安全處理,那些很容易被一些Hacker(黑客)所攻擊。并不是說(shuō)做了這些安全防范,這個(gè)應(yīng)用就百分之百的安全的。只是說(shuō)能夠盡可能加大破解難度。本文將詳細(xì)介紹Android安全防護(hù)之加密算法。
    2021-06-06
  • Android架構(gòu)組件Room的使用詳解

    Android架構(gòu)組件Room的使用詳解

    Room其實(shí)就是一個(gè)orm,抽象了SQLite的使用。這篇文章給大家介紹了Android架構(gòu)組件Room的使用詳解,需要的朋友參考下吧
    2017-12-12
  • Flutter實(shí)現(xiàn)旋轉(zhuǎn)掃描效果

    Flutter實(shí)現(xiàn)旋轉(zhuǎn)掃描效果

    這篇文章主要介紹了通過(guò)Flutter RotationTransition實(shí)現(xiàn)雷達(dá)旋轉(zhuǎn)掃描的效果,文中的示例代碼講解詳細(xì),感興趣的同學(xué)可以動(dòng)手試一試
    2022-01-01
  • Android顯式Intent與隱式Intent的使用詳解

    Android顯式Intent與隱式Intent的使用詳解

    Intent的中文意思是“意圖,意向”, Intent對(duì)Android的核心和靈魂,是各組件之間的橋梁。四大組件分別為Activity 、Service、BroadcastReceiver、ContentProvider。而這四種組件是獨(dú)立的,它們之間可以互相調(diào)用,協(xié)調(diào)工作,最終組成一個(gè)真正的Android應(yīng)用
    2022-09-09
  • kotlin使用建造者模式自定義對(duì)話框

    kotlin使用建造者模式自定義對(duì)話框

    這篇文章主要為大家詳細(xì)介紹了kotlin使用建造者模式自定義對(duì)話框的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-07-07
  • Android 仿抖音的評(píng)論列表的UI和效果的實(shí)現(xiàn)代碼

    Android 仿抖音的評(píng)論列表的UI和效果的實(shí)現(xiàn)代碼

    抖音是一款音樂(lè)創(chuàng)意短視頻社交軟件,此app已在android各大應(yīng)用商店和app store 上線。下面小編給大家?guī)?lái)了Android 仿抖音的評(píng)論列表的UI和效果的實(shí)現(xiàn)代碼,感興趣的朋友參考下吧
    2018-03-03
  • Android實(shí)現(xiàn)檢測(cè)手機(jī)搖晃的監(jiān)聽(tīng)器

    Android實(shí)現(xiàn)檢測(cè)手機(jī)搖晃的監(jiān)聽(tīng)器

    本文給大家分享一段代碼實(shí)現(xiàn)檢測(cè)手機(jī)搖晃的監(jiān)聽(tīng)器,代碼簡(jiǎn)單易懂,非常不錯(cuò),感興趣的朋友參考下吧
    2016-12-12
  • Android實(shí)現(xiàn)斷點(diǎn)下載的方法

    Android實(shí)現(xiàn)斷點(diǎn)下載的方法

    這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)斷點(diǎn)下載的方法,感興趣的小伙伴們可以參考一下
    2016-03-03

最新評(píng)論