Android开发之AutoCompleteTextView
2011-09-18 13:52
369 查看
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<AutoCompleteTextView
android:id="@+id/auto"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:completionHint="请选择你喜欢的书"
android:completionThreshold="1"/>
</LinearLayout>
---------------------------------------------------------------------------------------------------------------
package com.dirk.autocompletetextview;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
public class AutoCompleteTextViewActivity extends Activity {
AutoCompleteTextView auto;
String[] books=new String[]{"我的androdi讲义","我的java讲义","我的xml讲义","我的oracle讲义"};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ArrayAdapter<String> adapter=new ArrayAdapter<String>(AutoCompleteTextViewActivity.this, android.R.layout.simple_dropdown_item_1line,books);
auto=(AutoCompleteTextView)findViewById(R.id.auto);
auto.setAdapter(adapter);
}
}
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<AutoCompleteTextView
android:id="@+id/auto"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:completionHint="请选择你喜欢的书"
android:completionThreshold="1"/>
</LinearLayout>
---------------------------------------------------------------------------------------------------------------
package com.dirk.autocompletetextview;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
public class AutoCompleteTextViewActivity extends Activity {
AutoCompleteTextView auto;
String[] books=new String[]{"我的androdi讲义","我的java讲义","我的xml讲义","我的oracle讲义"};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ArrayAdapter<String> adapter=new ArrayAdapter<String>(AutoCompleteTextViewActivity.this, android.R.layout.simple_dropdown_item_1line,books);
auto=(AutoCompleteTextView)findViewById(R.id.auto);
auto.setAdapter(adapter);
}
}
相关文章推荐
- 【Android 开发教程】AutoCompleteTextView
- 【Android开发】AutoCompleteTextView的简单应用
- Android开发教程 --- 葵花宝典第五层 控件之 Menu DatePicker TimePicker AutoCompleteTextView MultiAutoCompleteTextView
- Android开发之--Auto Complete TextView的使用
- Android开发视频第二季之二:DatePicker、DatePickerDialog和AutoCompleteTextView
- android开发控件之AutoCompleteTextViewt
- android应用开发揭秘examples_04-10笔记(AutoCompleteTextView和MultiAutoCompleteTextView使用)
- Android开发之自动提示框—AutoCompleteTextView
- Android UI之AutoCompleteTextView
- Android UI之自定义AutoCompleteTextView
- Android之UI学习篇五:AutoCompleteTextView自动完成输入内容
- android EditText+ListView的组合(类似于AutoCompleteTextView)
- android中的AutoCompleteTextView与MultiAutoCompleteTextView
- Android学习备忘013——AutoCompleteTextView&MultiAutoCompleteTextView
- android文本自动提示 AutoCompleteTextView的实例2则
- ANDROID笔记:AutoCompleteTextView的简单使用
- Android控件之AutoCompleteTextView
- Android学习起步 - AutoCompleteTextView及MultiAutoCompleteTextView控件使用
- Android--UI之AutoCompleteTextView
- 【Android】自动提示匹配之AutoCompleteTextView