思考顺序:
1.intent添加错误
Intent it = new Intent(this,osc.class);
无误
2.清单文件中未注册
<activity
android:name="com.example.osc8bit.osc"
android:label="示波器" >
</activity>
无误
3.osc.java文件中onCreate方法未初始化osc界面
setContentView(R.layout.activity_main);
应当修改为:
setContentView(R.layout.osc);
4.问题
横竖屏切换
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setContentView(R.layout.osc);
5.问题
重写自定义View的三个方法
public WaveFormView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
public WaveFormView(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
public void onDraw(Canvas canvas) {
plotPoints(canvas);// 开始在canvas上画点
}