setContentView(R.layout.activity_main);
fastfind 空指针了。
1排除View.findViewById的问题。
2,查看自定义控件的构造方法,发现问题,构造写错了,串联构造时,参数写错了,改为如下
public Fastfind(Context context) {
this(context, null);
}
public Fastfind(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public Fastfind(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setTypeface(Typeface.DEFAULT_BOLD);
paint.setColor(Color.WHITE);
}