如何设置文本在一个EditText [英] How To Set Text In An EditText
本文介绍了如何设置文本在一个EditText的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何设置一个EditText?
How can I set the text of an EditText?
推荐答案
如果您检查文档的<一个href="http://developer.android.com/reference/android/widget/EditText.html"><$c$c>EditText$c$c>,你会发现一个的setText()
方法。这需要在字符串
和<一href="http://developer.android.com/reference/android/widget/TextView.BufferType.html"><$c$c>TextView.BufferType$c$c>.例如:
If you check the docs for EditText
, you'll find a setText()
method. It takes in a String
and a TextView.BufferType
. For example:
EditText editText = (EditText)findViewById(R.id.edit_text);
editText.setText("Google is your friend.", TextView.BufferType.EDITABLE);
这篇关于如何设置文本在一个EditText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文