A finger drag in a vertical motion (up/down) should only be detected inside the image of the imageview, not outside. However, in the area above the image it detects the drag. No where else is a drag detected, nor on the left, right or the bottom but only in the area directly above the image. It works inside the image but also outside above it, which it shouldn't do. I've tried a number of things to resolve this but nothing has worked. Can someone please help?
So, in my onCreate in my activity I have the method that was created to scale the image:
redShape = (ImageView) findViewById(R.id.image1);
scaleImage();
In Motion event, action down:
rect = new Rect(redShape.getLeft(),redShape.getTop(),redShape.getRight(),redShape.getBottom());
In action move:
if (rect.contains(posX, posY)){
In the if statement above I just have the code that counts whenever a drag is made.
EDIT 1:
drawableHeight = drawable2.getIntrinsicHeight();
drawableWidth = drawable2.getIntrinsicWidth();
drawableRect = new RectF(0, 0, drawableWidth, drawableHeight);
m.mapRect(drawableRect);
Do I do this next (by the way, redShape is the imageview):
redShape.setImageMatrix(m);
In rect.contains(posX,posY) do I change that to drawableRect.contains(posX,posY)?
EDIT 2:
public void onWindowFocusChanged(boolean hasFocus) {
// TODO Auto-generated method stub
super.onWindowFocusChanged(hasFocus);
Log.i(" test 3 ", "width : " + redShape.getWidth() + "height: " + redShape.getHeight());
}