今天我们要讲一个十分简单的内容,就是一个安卓控件的使用,用法很简单,但是很常用的一个。这里我用两种不同的写法来处理。当然,无论用哪一种写法,效果都是一样的。
我们先来看效果图。
要实现这种效果十分简单。需要一个控件,AutoCompleteTextView,他是EidtView的子类
我们先看第一种写法
先看布局文件
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
android:id="@+id/auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
>
autocomplete.xml
然后就主类文件
package com.example.mydemo.autotextview;
import java.util.ArrayList;
import jav