0

我已经看过十亿次了,但找不到答案。如何在单击时在编辑文本框中输入预定义文本?我希望按钮读取语句,当用户单击按钮时,会显示附加到文本的 url。

4

3 回答 3

4

不知道你想要什么...

final EditText edit = (EditText) this.findViewById(R.id.editText1);
Button btn = (Button) this.findViewById(R.id.button1);

btn.setOnClickListener(new OnClickListener() {

    public void onClick(View arg0) {
        // TODO Auto-generated method stub
        edit.setText("your text");
    }

});
于 2012-05-08T02:45:05.967 回答
2

希望这对你有帮助

button = (Button)findViewById(R.id.button1);
editText = (EditText)findViewById(R.id.editText1);

    final String _url = "http://yoururl";
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            editText.setText(_url);
        }
    });
于 2012-05-08T02:53:31.307 回答
1

EditText.setText("你的文字在这里");

这就是你需要做的。(好吧,将它包装在您的点击侦听器中并获取 id,但我假设您知道这一点)。

于 2012-05-08T02:47:13.987 回答