当前位置: 代码迷 >> Eclipse >> 程序错在哪?解决方案
  详细解决方案

程序错在哪?解决方案

热度:315   发布时间:2016-04-23 18:57:17.0
程序错在哪?
package ds.cd;

import android.app.Activity;
import android.os.Bundle;

public class hsj extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView v=new TextView(this); //这边提示错误 Multiple markers at this line
- TextView cannot be resolved to a type
- TextView cannot be resolved to a type 
}
} 是什么意思呢?我的是android 2.2的

------解决方案--------------------
Java code
package sample.Acti;import android.app.Activity;import android.os.Bundle;import android.widget.TextView;public class Acti extends Activity {    public class Activity_01 extends Activity {    /** Called when the activity is first created. */    @Override    public void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);//调用父类的构造方法        setContentView(R.layout.main);//展示视图界面                   //TextView myTextView = new TextView(this);        TextView myTextView = (TextView)findViewById(R.id.myTextView);        myTextView.setText("first textview");         }}}//为什么不发在android板块
  相关解决方案