Android的文本提示框有两种方式:

main.xml文件

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" > <TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="模糊查询" />
<AutoCompleteTextView
android:id="@+id/autotext"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<MultiAutoCompleteTextView
android:id="@+id/mull"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/> </LinearLayout>

MainActivity.java文件

package cn.szy.com;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.MultiAutoCompleteTextView; public class MainActivity extends Activity {
/** Called when the activity is first created. */
private MultiAutoCompleteTextView move;
private AutoCompleteTextView auto;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main); auto = (AutoCompleteTextView)this.findViewById(R.id.autotext);
String [] autoStrings = new String [] {
"联合国",
"联合军",
"联邦"
};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(MainActivity.this,android.R.layout.simple_dropdown_item_1line,autoStrings);
auto.setAdapter(adapter) ;
move = (MultiAutoCompleteTextView)this.findViewById(R.id.mull);
move.setAdapter(adapter) ;
move.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
}
}

Java-Android 之输入提示框的更多相关文章

  1. Android 讲述Help提示框

    Android 讲述Help提示框 XML/HTML代码 <stringname="help_dialog_text"> <i>Author:fonter. ...

  2. Cocos2d-x C++调用Android弹出提示框

    转载请注明地址,谢谢.. Cocos2d-x中提供了一个JniHelper类来让我们对Jni进行操作. (PS:弄了一天想自己写代码操作Jni的,但是总是出错,技术差不得不使用Cocos2d-x现成的 ...

  3. Android 的一些提示框

    1.在测试时,如何实现一个提示 可以使用 Toast.makeText(this, "这是一个提示", Toast.LENGTH_SHORT).show(); //从资源文件str ...

  4. Android自己定义提示框

    在开发中,假设感觉系统自带的提示框不好看,开发人员能够自定义提示框的样式.主要是继承Dialog 程序文件夹结构 关键代码 package com.dzt.custom.dialog; import ...

  5. Android弹出输入提示框--PopupWindow实现

    前言  之前直接用Dialog实现了弹出对话框.现在尝试用更好地解决方案--PopupWindow类--来实现 1.首先搞一个弹出框布局,和之前类似. 这样的东西,它的布局是这样: 1 <?xm ...

  6. Android开发 ---构建对话框Builder对象,消息提示框、列表对话框、单选提示框、多选提示框、日期/时间对话框、进度条对话框、自定义对话框、投影

    效果图: 1.activity_main.xml 描述: a.定义了一个消息提示框按钮 点击按钮弹出消息 b.定义了一个选择城市的输入框 点击按钮选择城市 c.定义了一个单选提示框按钮 点击按钮选择某 ...

  7. JQuery+AJAX实现搜索文本框的输入提示功能

    平时使用谷歌搜索的时候发现只要在文本框里输入部分单词或字母,下面马上会弹出一个相关信息的内容框可供选择.感觉这个功能有较好的用户体验,所以也想在自己的网站上加上这种输入提示框. 实现的原理其实很简单, ...

  8. 使提示框居中显示&自定义提示框

    ToastActivity.java文件: 1 public class ToastActivity extends AppCompatActivity { 2 private Button mbtn ...

  9. 【高德地图API】从零开始学高德JS API(四)搜索服务——POI搜索|自动完成|输入提示|行政区域|交叉路口|自有数据检索

    原文:[高德地图API]从零开始学高德JS API(四)搜索服务——POI搜索|自动完成|输入提示|行政区域|交叉路口|自有数据检索 摘要:地图服务,大家能想到哪些?POI搜素,输入提示,地址解析,公 ...

随机推荐

  1. javascript学习代码-判断闰年

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  2. UIWebView 自定义网页中的alert和confirm提示框风格

    .h #import <UIKit/UIKit.h> @interface UIWebView (JavaScriptAlert) -(void)webView:(UIWebView *) ...

  3. Nodejs异步

    http://cnodejs.org/topic/4f16442ccae1f4aa2700113b http://cnodejs.org/topic/4f16442ccae1f4aa27001123 ...

  4. SVN ignores

    在windows下面用SVN 用命令行不是很方便,dos很烦的,所以一般都会用tourist svn mac下牛人都喜欢直接敲命令行,比如svn co http:// 等等.. 不过为了看得清楚,有必 ...

  5. vim配置vimrc详解(转)

    vimrc的存放位置: 系统 vimrc 文件: "$VIM/vimrc" 用户 vimrc 文件: "$HOME/.vimrc" 用户 exrc 文件: &q ...

  6. mysql中TimeStamp和Date的转换

    mysql 查询时间戳(TIMESTAMP)转成常用可读时间格式 from_unixtime()是MySQL里的时间函数 date为需要处理的参数(该参数是Unix 时间戳),可以是字段名,也可以直接 ...

  7. Linux启动或禁止SSH用户及IP的登录

    启动或禁止SSH用户登录 一般情况下,在使用Linux操作系统都不会去机房来操作机器,都是使用一些第三方的工具来操作. 比如使用SSH Secure File Transfer Client工具来传输 ...

  8. 2.5.2 使用alertdialog 创建列表对话框

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout ...

  9. XP与Win2003下网站配置

    一. 安装.net 4.0 1. 双击打开文件dotNetFx40_Full_x86_x64.exe.如图4.1 所示 (图4.1) 2. 勾选[我已阅读并结束许可条款],点击[安装]按钮.如图4.2 ...

  10. HDU 4720 Naive and Silly Muggles 2013年四川省赛题

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4720 题目大意:给你四个点,用前三个点绘制一个最小的圆,而这三个点必须在圆上或者在圆内,判断最一个点如 ...