简体   繁体   English

如何在Android的EditText中添加视图?

[英]How to add a view into a EditText in android?

This is an mms app. 这是一个彩信应用程序。 i'm new here, so i can't upload a picture. 我是新来的,所以我不能上传图片。 i'm so sorry about that. 我对此感到很抱歉。

the question is : when user attach a picture to send an mms, i must create a view in the IputBox(EditText) to show the image's info like size, type and so on. 问题是:当用户附加图片以发送彩信时,我必须在IputBox(EditText)创建一个视图以显示图像的信息,例如大小,类型等。

So, How can I create a view in EditText ? 因此,如何在EditText创建视图?

I konw How to insert a image into a EditText by ImageSpan , but I don't know how to insert a view. 我知道如何通过ImageSpan将图像插入到EditText ,但是我不知道如何插入视图。

Thank u!! 感谢你!!

您不能在EditText内创建视图,但是可以在布局XML中创建隐藏视图,并仅在相关时显示所需信息。

You can use this I think: 我认为您可以使用此:

setText(CharSequence)

To set some text that appears within the EditText. 设置一些出现在EditText中的文本。 Not used it myself however so can't say for certain it will work. 我自己没有使用过它,所以不能肯定地说它会起作用。

Got it from here: http://developer.android.com/reference/android/widget/EditText.html 从这里得到它: http : //developer.android.com/reference/android/widget/EditText.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM