主activity名为MyPaint,其对应的布局文件为paint_layout.xml,我声明了一个MyView继承了view,代码如下:
package com.example.wifidetection;
···
public class MyPaint extends ActionBarActivity {
···
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.paint_layout);
在paint_layout.xml中是这样写的
``
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
Myview是这样:
``` public class MyView extends View
{
···
public MyView(Context context , AttributeSet attrs){
//public MyView(Context context){
super(context , attrs);
但这样写了之后,在paint_layout.xml的Graphical Layout里面就会显示:
The following classes could not be instantiated:
- com.example.wifidetection.MyPaint (Open Class, Show Error Log)
我是彩笔,求大神解答,感激!