如何自动填写Android应用程序编辑的文本? [英] How to auto fill an edit text in android application?

查看:110
本文介绍了如何自动填写Android应用程序编辑的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一款使用Android操作系统的应用程序。在这我有一些产品,并形成购买该产品。在订单我有一个编辑文本的产品(指产品名称)。

I am developing one android application. In which I have some Products and form to purchase that product. In the Order form I have one Edit Text as Product ( means product name) .

在我的应用程序的用户必须输入产品名称,但我想知道,有没有什么办法,
所述的EditText字段自动填充与该特定产品等作为在flipcart

In my application user has to type Product name but I want to know that Is there any way that the EditText field is autofilled with that particular Product like as in flipcart.

任何人知道,然后建议我...

Any one knows then suggest me...

在此先感谢...

推荐答案

当你想填充它只是调用(在这个例子从XML布局看完后):

When you want to populate it just call (after reading it in from the XML layout in this example):

EditText myTextBox = (EditText) findViewById(R.id.editBox);
myTextBox.setText("My Product Description");

如果你正在寻找的是在他们已经开始打字的自动完成,那么<​​code> AutoCompleteTextView 是你最好的选择,更换的EditText并提供自动完成功能

If what you are looking for is an auto completion after they have started typing, then an AutoCompleteTextView is your best bet, replacing the EditText and providing the auto complete functionality

有是这种过度的Andr​​oid开发者网站的例子:
http://developer.android.com/guide/topics/ui /controls/text.html#AutoComplete

There is an example of this over at the Android Developers website: http://developer.android.com/guide/topics/ui/controls/text.html#AutoComplete

这篇关于如何自动填写Android应用程序编辑的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆