zoukankan      html  css  js  c++  java
  • ANDROID笔记:AutoCompleteTextView的简单使用

     1 package com.example.autotextview;
     2 
     3 import android.app.Activity;
     4 import android.os.Bundle;
     5 import android.widget.ArrayAdapter;
     6 import android.widget.AutoCompleteTextView;
     7 
     8 import com.example.adaptertest.R;
     9 
    10 public class AutoTextActivity extends Activity {
    11     @Override
    12     protected void onCreate(Bundle savedInstanceState) {
    13         // TODO Auto-generated method stub
    14         super.onCreate(savedInstanceState);
    15         setContentView(R.layout.autoconpletetext);
    16         
    17         AutoCompleteTextView autoCompleteTextView = (AutoCompleteTextView) findViewById(R.id.autotext);
    18         ArrayAdapter<String> adapter = new ArrayAdapter<String>(
    19                 AutoTextActivity.this, android.R.layout.simple_list_item_1,new String[]{"java","net","android"});
    20         autoCompleteTextView.setAdapter(adapter);
    21 
    22     }
    23 }
     1 <?xml version="1.0" encoding="utf-8"?>
     2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     3     android:layout_width="match_parent"
     4     android:layout_height="match_parent"
     5     android:orientation="vertical" >
     6 
     7     <AutoCompleteTextView
     8         android:id="@+id/autotext"
     9         android:layout_width="100dp"
    10         android:layout_height="wrap_content"
    11         android:completionHint="选中语言"
    12         android:completionThreshold="1"
    13         android:dropDownHeight="300dp" />
    14     <!-- completionThreshold:输入几个字母时匹配 -->
    15     <!-- dropDownHeight: 提示框高度 -->
    16 
    17 </LinearLayout>
  • 相关阅读:
    求最短路径的三种算法: Ford, Dijkstra和Floyd
    Huffman树与编码
    Logistic回归模型和Python实现
    LibSVM for Python 使用
    支持向量机原理
    朴素贝叶斯分类器及Python实现
    Http协议简介
    介绍50个 WordPress 动作挂钩
    决定如何开发你的WordPress主题框架
    WordPress 主题框架是如何工作的
  • 原文地址:https://www.cnblogs.com/afluy/p/3374474.html
Copyright © 2011-2022 走看看