eclipse ADT添加EditText代码后报错,求指导
功能就是在EditText中输入的信息在另一个TextView中显示出来,错误基本都是EditTextcannotberesolvedtoatype这样的,我也打了这个i...
功能就是在EditText中输入的信息在另一个TextView中显示出来,错误基本都是
EditText cannot be resolved to a type这样的,我也打了这个import android.widget.TextView;还是出错
代码如下:
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
EditText = (EditText) findViewById (R.id.editText1);
EditText.addTextChangedListener (new TextWatcher(){
@override
public void afterTextChanged (Editable s) {
}
@override
public void beforeTextChanged (CharSequence s, int start ,int count, int after){
}
@override
public void onTextChanged (CharSequence s, int start, int before, int count){
String text=editText.getText().toString();
textview.setText(text);
}
}); 展开
EditText cannot be resolved to a type这样的,我也打了这个import android.widget.TextView;还是出错
代码如下:
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
EditText = (EditText) findViewById (R.id.editText1);
EditText.addTextChangedListener (new TextWatcher(){
@override
public void afterTextChanged (Editable s) {
}
@override
public void beforeTextChanged (CharSequence s, int start ,int count, int after){
}
@override
public void onTextChanged (CharSequence s, int start, int before, int count){
String text=editText.getText().toString();
textview.setText(text);
}
}); 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询