位置: 编程技术 - 正文

android中实现自动输入文本效果(android 自定义)

编辑:rootadmin

推荐整理分享android中实现自动输入文本效果(android 自定义),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:android自定义loading,android ui自动化,android 自动操作,android 自动操作,android自动化,android 自动操作,安卓自动化有几种方法,安卓自动化有几种方法,内容如对您有帮助,希望把文章链接给更多的朋友!

此控件的功能是帮助用户实现自动输入,例如当用户输入一个字符后,能够根据这个字符提示显示出与之相关的数据。里面用到了一个适配器来实现此功能.

源代码如下:

android中实现自动输入文本效果(android 自定义)

package com.example.autosearch;import android.R.string;import android.os.Bundle;import android.app.Activity;import android.view.Menu;import android.view.View;import android.widget.ArrayAdapter;import android.widget.AutoCompleteTextView;import android.widget.Button;import android.widget.TextView;public class AutoSearch extends Activity { private String[] normalString = new String[]{ "android","android blog","android market","android sdk", "Java 2SE","java 2me","mobile","IBM","Google" }; @SuppressWarnings("unused") private TextView TextView_InputShow; private AutoCompleteTextView AutoCompleteTextView_Input; private Button Button_clean; private ArrayAdapter<String> arrayAdapter;@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);TextView_InputShow = (TextView)findViewById(R.id.TextView_InputShow);AutoCompleteTextView_Input = (AutoCompleteTextView)findViewById(R.id.AutoCompleteTextView_Input);Button_clean = (Button)findViewById(R.id.Button_clean);//适配器对象的实现,给自动完成输入框添加自动装入的内容arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line,normalString);//给自动输入框添加内容适配器AutoCompleteTextView_Input.setAdapter(arrayAdapter);Button_clean.setOnClickListener(new Button.OnClickListener(){@Overridepublic void onClick(View arg0) {// TODO Auto-generated method stub//清空AutoCompleteTextView_Input.setText("");}});}@Overridepublic boolean onCreateOptionsMenu(Menu menu) {// Inflate the menu; this adds items to the action bar if it is present.getMenuInflater().inflate(R.menu.auto_search, menu);return true;}}

XML文件如下:

<?xml version="1.0" encoding="utf-8"?><AbsoluteLayout xmlns:android=" android:id="@&#;id/widget0" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@&#;id/TextView_InputShow" android:layout_width="px" android:layout_height="px" android:layout_x="px" android:layout_y="px" android:text="请输入:" android:textSize="px" /> <AutoCompleteTextView android:id="@&#;id/AutoCompleteTextView_Input" android:layout_width="px" android:layout_height="wrap_content" android:layout_x="px" android:layout_y="px" android:text="" android:textSize="sp" > </AutoCompleteTextView> <Button android:id="@&#;id/Button_clean" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_x="dip" android:layout_y="dip" android:text="清空" /></AbsoluteLayout>

DELPHI XE7XE8 移动开发,Android、iOS XE8下载地址:

Android界面切换 这段时间一直在忙Android的项目,总算抽出点时间休息一下,准备把一些项目用到的Android经验分享一下。在Android开发过程中,经常会碰到Activity之间的切

快速进入Android世界(上) Android概述Android是什么Android是一种以Linux为基础的开放源码操作系统和应用程序,主要使用于便携设备。Android操作系统最初由AndyRubin开发,最初主要支

标签: android 自定义

本文链接地址:https://www.jiuchutong.com/biancheng/386092.html 转载请保留说明!

上一篇:android的SDK离线安装详细教程(androidstudio离线配置环境)

下一篇:DELPHI XE7XE8 移动开发,Android、iOS(delphi7教程)

  • 固定资产装修费用计入房产税吗
  • 公司兼职的工资怎么发
  • 建筑工程查帐征收税
  • 个体户自有厂房怎么申请
  • 股份制改造而发生的资产评估增值税法规定
  • 如何申请免税
  • 进料加工企业的增值税如何处理
  • 公司转让会计分录
  • 非货币性资产交换的记忆口诀
  • 淘宝电商会计交税怎么交?
  • 保费收入包含
  • 员工午餐补贴可以入福利费吗?
  • 协方差cov计算公式展开
  • 核定征收金额如何确定
  • 工业企业成本结转金额怎么确定
  • 建筑行业挂靠什么意思
  • 备查账要如何设置?
  • 1697506686
  • 现金流量表的余额和资产负债表货币资金是不是一定相等
  • 往来款核销需要如何确认
  • 福利费进行税额转出
  • 物业公司物业费都交什么税
  • php代码自动生成
  • vlookup函数怎么用跨表格匹配
  • 多付货款退回的会计分录
  • 工业企业汽车发生费用处理
  • 公租房租金收入免企业所得税吗
  • 发放职工工资计入什么会计科目
  • 三元运算符判断闰年php
  • 存货怎么预估
  • yolov5讲解
  • 债券利息计算方法
  • 解决方案啥意思
  • 实例讲解YII2中多表关联的使用方法
  • php 截断
  • 现代服务业进项税加计扣除申报怎么填
  • 损益类科目资产增加在借方还是贷方
  • unplugin-auto-import/vite
  • 因果推断的常用标准
  • 应届生优势大吗
  • ps中分辨率
  • 企业待报解预算收入的分录
  • 增值税申报表各栏怎么填
  • 自建厂房流程
  • 代理进口业务应纳的关税
  • 打印银行电子回单在打印机上怎么设置A5
  • php static function
  • linux mysql 找回密码
  • 企业促销费用项目有哪些
  • 付承包费计入什么科目
  • 用货款抵扣供应商成本
  • 不良品怎么入账
  • 以前年度少计提的工资怎么处理
  • 无形资产出资入股的会计处理
  • centos yun
  • sql 截取字符串某个字符之后
  • mysql 存过
  • rpm方式安装
  • Windows Server 2003报错无法定位程序输入点DecodePointer解决方法
  • RSync文件备份同步 Linux服务器rsync同步配置图文教程
  • 如何查看freenass密码
  • 取消windows 7的自动关机如何设置
  • broadcom网卡配置
  • ubuntu下安装deb文件
  • win7禁用驱动签名后可以正常启动吗
  • mac上安装
  • 苹果笔记本mac系列区别
  • linux在实际工作中的应用
  • java语言的解释器是什么
  • linux c程序开发
  • javascript编写
  • cmd 字符集
  • vuex按需加载
  • javascript基础笔记
  • 湖北税务官方网
  • 深圳市地税局财务电话
  • 淘宝要补偿怎么回复
  • ic卡读取失败是怎么回事
  • 2023年企业所得税计算公式表
  • 深圳市国家税务局
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设