2 回答
TA贡献2037条经验 获得超6个赞
可能是你错过了大括号,
公共类 MainActivity 扩展 AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
EditText Username = (EditText) findViewById(R.id.EmployerNameEdit);
String userName = Username.getText().toString();
TextView changedName = (TextView) findViewById(R.id.employerName);
changedName.setText(userName);
}
}
如果您仍然遇到问题,请随时提出问题。:)
TA贡献1850条经验 获得超11个赞
oncreate 或 create global edittext 和 TextView 中的每件事
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
EditText Username = (EditText) findViewById(R.id.EmployerNameEdit);
String userName = Username.getText().toString();
TextView changedName = (TextView) findViewById(R.id.employerName);
changedName.setText(userName);
}
添加回答
举报