I think most of people have played the "angry birds". It can magnify
or shrink background when you move your two finger.
I want to get the two start point like a(x1, y1) and b(x2, y2), and
the two last point c(x3, y3) and d(x4, y4)
if ( (x1 - x2) < (x3 - x4) || (y1 - y2) < (y3 - y4)) {
// shrink
} else {
// magnify
}
the I tested following code:
public void onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_MOVE) {
mTouchX = event.getX();
mTouchY = event.getY();
Log.d("harvey", "move(x, y) = " + " ( " + mTouchX + "
, " + mTouchY + " )");
} else if (event.getAction() == MotionEvent.ACTION_DOWN) {
Log.d("harvey", "down(x1, y1) = " + "(" + event.getX()
+ ", " + event.getY() + ")");
} else if(event.getAction() == MotionEvent.ACTION_UP) {
Log.d("harvey", "up(x1, y1) = " + "(" + event.getX() +
", " + event.getY() + ")");
}
super.onTouchEvent(event);
}
Form the log, it seams that can only get one finger's position, but
not the two finger at the same time.
Would you provider any idea how to implement this?
--
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