zoukankan      html  css  js  c++  java
  • 文件提示

    引用:http://blog.csdn.net/jamesliulyc/article/details/6282354

    目录结构

    第一步

    auto_complete_text.xml

    [xhtml] view plaincopy
    1. <?xml version="1.0" encoding="utf-8"?>  
    2. <LinearLayout  
    3.   xmlns:android="http://schemas.android.com/apk/res/android"  
    4.   android:layout_width="fill_parent"  
    5.   android:layout_height="fill_parent">  
    6.   <AutoCompleteTextView   
    7.         android:id="@+id/myAutoCompleteTextView"  
    8.         android:layout_width="fill_parent"  
    9.         android:layout_height="wrap_content" />  
    10. </LinearLayout>  

    第二步

    MainActivity.java

    1. package com.taofu5;  
    2.   
    3. import com.taofu5.R;  
    4.   
    5. import android.app.Activity;  
    6. import android.os.Bundle;  
    7. import android.widget.ArrayAdapter;  
    8. import android.widget.AutoCompleteTextView;  
    9.   
    10. public class MainActivity extends Activity {  
    11.       
    12.     private static final String[] myStr = {"aaa","bbb","ccc","aabb","aad"};  
    13.     @Override  
    14.     public void onCreate(Bundle savedInstanceState) {  
    15.         super.onCreate(savedInstanceState);  
    16.         setContentView(R.layout.auto_complete_text);  
    17.         ArrayAdapter<String> aa =   
    18.             new ArrayAdapter<String>(this,   
    19.                     android.R.layout.simple_dropdown_item_1line,myStr) {  
    20.         };  
    21.         AutoCompleteTextView textView =   
    22.             (AutoCompleteTextView) findViewById(R.id.myAutoCompleteTextView);  
    23.         textView.setAdapter(aa);  
    24.         textView.setThreshold(1);  
    25.     }  
    26. }  

    第三步

    AndroidManifest.xml

    [xhtml] view plaincopy
    1. <?xml version="1.0" encoding="utf-8"?>  
    2. <manifest xmlns:android="http://schemas.android.com/apk/res/android"  
    3.       package="com.taofu5"  
    4.       android:versionCode="1"  
    5.       android:versionName="1.0">  
    6.     <application android:icon="@drawable/icon" android:label="@string/app_name">  
    7.         <activity android:name=".MainActivity"  
    8.                   android:label="@string/app_name">  
    9.             <intent-filter>  
    10.                 <action android:name="android.intent.action.MAIN" />  
    11.                 <category android:name="android.intent.category.LAUNCHER" />  
    12.             </intent-filter>  
    13.         </activity>  
    14.   
    15.     </application>  
    16.     <uses-sdk android:minSdkVersion="7" />  
    17.   
    18. </manifest>   

    效果图如下:

    That's all.

  • 相关阅读:
    Windows光标形状
    函数对象(仿函数 functor)
    构造函数的初始化列表抛出异常
    <<Windows via C/C++>>学习笔记 —— 线程优先级【转】
    单例模式
    c++中的重载(Overload)、覆盖(重写,Override) 、隐藏与访问权限控制及using声明
    RTTI: dynamic_cast typeid
    抽象类 虚函数 声明与实现
    typedef 函数指针 数组 std::function
    Client Window坐标 RECT相关函数
  • 原文地址:https://www.cnblogs.com/sode/p/2844192.html
Copyright © 2011-2022 走看看