新手学安卓,画布写的字不显示?
恩,新建个View,复写了onDraw方法
protected void onDraw(Canvas canvas) {,然后在MainActivity中设置引用这个View
Paint p=new Paint();
p.setColor(Color.RED);
canvas.drawText("Game",0,0, p);
super.onDraw(canvas);
}
protected void onCreate(Bundle savedInstanceState) {,不知道为何模拟器打开就是一片空白,没有Game字样呢,求解
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(new GameV(this));
}