package app.test;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
public class Test extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setTitle("AutoCompleteTextViewActivity");
ArrayAdapter adapter = new ArrayAdapter(this,
android.R.layout.simple_dropdown_item_1line, COUNTRIES);
AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.auto_complete);
textView.setAdapter(adapter);
}
static final String[] COUNTRIES = new String[] { "China", "Russia",
"Germany", "Ukraine", "Belarus", "USA", "China1", "China12",
"Germany", "Russia2", "Belarus", "USA" };
}
//main.xml
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>