如何在onDraw()中闪烁位图箭头图像

时间:2014-07-09 20:00:03

标签: android

我想在我的onDraw()中绘制闪烁的位图图像,请帮助

@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
bitmap= BitmapFactory.decodeResource(getResources(),
            R.drawable.imagebitmap);
bitmap = Bitmap.createScaledBitmap(pinMarker, 150,150,
            true);
 canvas.drawBitmap(bitmap, left, top, paint)
    }



 I'm expecting some gud suggestions from all of you :).

1 个答案:

答案 0 :(得分:0)

private void clueFoundPinNotification(Canvas c, float x, float y) {
    float newY = 0;int yVelocity = 30;
    //Load image in bitmap      
    if (mPinPointer == null) {
        mPinPointer = BitmapFactory.decodeResource(getResources(),
                R.drawable.pointer);
        mPinPointer = Bitmap.createScaledBitmap(mPinPointer, 40, 40, true);
    }
    // my requirement was move pin up-down so I used y coordinate only
    if (newY <= 0)
        newY = y - 80;
    newY += yVelocity;
    if ((newY > y - 70) || (newY <= y - 80)) {
        yVelocity = yVelocity * -1;
    }

    c.drawBitmap(mPinPointer, x + 15, newY, null);
    Log.i(TAG, "clueFound-x " + x + "clueFound-y " + y);

}