我该如何在我的TextView中显示一个EditText? [英] How do i get a EditText to display in my TextView?

查看:98
本文介绍了我该如何在我的TextView中显示一个EditText?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,我试图用button"Ok"来显示EditText,以显示在TextView输出中显示的内容. 按下确定" button后,它会得到在EditText中输入的文本,并显示在TextView中.

Basically I'm trying to get my EditText with a button "Ok" to display what was written to show up in a TextView output. Once the "Ok" button is pressed it get the text what was entered in the EditText and display in the TextView.

曾经四处搜寻,却找不到任何有效的方法.有人可以帮忙吗?

Been searching around and can't find anything that works. Can anyone help?

1)非常感谢您的回应和帮助. 2)我想我是问错了. 我正在尝试创建一个选项,用户可以在其中将自己的文本添加到活动中.

1) really appreciate the responds and help guys. 2) I think I"m asking this wrong. What I'm trying to do is creating an option where the user can add their own Text into an activity.

谢谢您的帮助!!!!!!!!!!!!

THANK YOU FOR THE HELP!!!!!!!!!!!!

推荐答案

EditText

editText.getText().toString();

Button Click

textView.setText(editText.getText().toString());

更新:

类似于

 Button negativeButton = (Button) findViewById(R.id.ButtonID);

 negativeButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
             textView.setText(editText.getText().toString());
        }
    });

这篇关于我该如何在我的TextView中显示一个EditText?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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