好吧所以我要开发一个应用程序,通过点击按钮将文本从edittext转到textview,这就是我到目前为止对java的一个菜鸟
package one.two;
import android.app.Activity;
import android.os.Bundle;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.Button;
import java.util.Scanner;
public class one extends Activity {
public static void main(String args[]){
Scanner what = new Scanner(System.in);
what.toString();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
答案 0 :(得分:1)
Button btn = findViewById(yourButtonId);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
EditText txt = findViewById(yourEditTextId);
TextView txt1 = findViewById(yourTextViewId);
txt.setText( txt.getText().toString() );
}
});