https://blog.csdn.net/jasoncol_521/article/details/12556473
https://ask.csdn.net/questions/11296
***********************************************************
Play.java
private View view;
LinearLayout linearLayout;
final GameView gameView=new GameView(this);
setContentView(R.layout.play);
//1
linearLayout=(LinearLayout)findViewById(R.id.play_view1);
LayoutInflater inflater= (LayoutInflater)this.getSystemService (LAYOUT_INFLATER_SERVICE);
//view=inflater.inflate(R.layout.play,null);
linearLayout.addView(gameView);
//1
class GameView extends View{
Paint paint=new Paint();
public GameView(Context context){
super(context);
setFocusable(true);
}
public void onDraw(Canvas canvas){
paint.setStyle(Paint.Style.FILL);
paint.setAntiAlias(true);