您好,欢迎访问四川鑫光豪耀机电有限公司!

咨询热线:

18980820575
✕

营山发电机维修,营山柴油发电机维修,品牌发电机维修,发电机维修服务公司

怎么在Android应用中实现一个动态匹配输入的内容功能-创新互联

怎么在Android应用中实现一个动态匹配输入的内容功能?针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

创新互联云计算的互联网服务提供商,拥有超过13年的服务器租用、雅安机房托管、云服务器、网络空间、网站系统开发经验,已先后获得国家工业和信息化部颁发的互联网数据中心业务许可证。专业提供云主机、网络空间、域名与空间、VPS主机、云服务器、香港云服务器、免备案服务器等。

一、AutoCompleteTextView

独特属性:android:completionThreshold=”2”—–设置输入多少字符时自动匹配

首先,我们先在res文件夹(我用的是AndroidStudio)下的active_main.xml下面加入AutoCompleteTextView控件,并设置好大小宽高等其他一些基础属性

<&#63;xml version="1.0" encoding="utf-8"&#63;>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 tools:context="com.example.admin.demo.MainActivity">

 <AutoCompleteTextView
 android:completionThreshold="2" 
 android:id="@+id/autoCompleteTextView1"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:hint="请输入你要搜索的关键词"
 />
</LinearLayout>
友情链接 :