There's some API Demos close to what you're try do. Take a look at AnimateDrawables or FingerPaint for example...
On May 28, 1:34 pm, Jagadeesh <[email protected]> wrote: > Hi > iam making game application ,i have designed gameplate with background and > grid with canvas and paint . > > i need insert one ball with screen keepon coming from top of the screen how > to implement ,i was trying insert image but background domainating can any > one help this. > > here my code: > package com.ibr; > > import android.app.Activity; > import android.content.Context; > import android.graphics.Canvas; > import android.graphics.Color; > import android.graphics.Paint; > import android.graphics.Paint.Style; > import android.os.Bundle; > import android.view.Display; > import android.view.KeyEvent; > import android.view.View; > > public class BallRacing extends Activity { > DemoView demoview; > int width = 0; > int height = 0; > int pass = 0; > int xpos = 0; > int ypos = 0; > > /** Called when the activity is first created. */ > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > demoview = new DemoView(this); > setContentView(demoview); > } > @Override > public boolean onKeyDown(int keyCode, KeyEvent event) { > return super.onKeyDown(keyCode, event); > } > > private class DemoView extends View { > public DemoView(Context context) { > super(context); > } > > @Override > protected void onDraw(Canvas canvas) { > super.onDraw(canvas); > > // custom drawing code here > // remember: y increases from top to bottom > // x increases from left to right > > Paint paint = new Paint(); > paint.setStyle(Paint.Style.FILL); > > // make the entire canvas white > paint.setColor(Color.TRANSPARENT); > canvas.drawPaint(paint); > > Display display = getWindowManager().getDefaultDisplay(); > width = display.getWidth();//start > height = display.getHeight();//end > > xpos = width / 7; > ypos = height/7; > for (int i = 0; i < 7; i++) { > > paint.setColor(Color.WHITE); > canvas.drawLine(xpos +(xpos*i), 0, xpos +(xpos*i), height, > paint); > //canvas.drawLine(startX, startY, stopX, stopY, paint) > > } > paint.setStyle(Style.STROKE); > for (int i = 0; i < 15; i++) { > > paint.setColor(Color.WHITE); > canvas.drawLine(0, (ypos*pass)+ 5, width, (ypos*pass)+5, > paint); > pass++; > > } > } > } > > > > > > > > } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

