cannt scroll imageview right and down

by Chenguo » Thu, 08 May 2008 00:53:55 GMT

Sponsored Links
I add onTouchEvent method to ImageSwitcher of API Demo, and i'd like to scroll 
the image in this method.But the image cannt be scrolled right and down from 
its original place.The following is my code:

private float mx,my;
    public boolean onTouchEvent(MotionEvent event)
     ImageView switcherView = (ImageView)mSwitcher.getCurrentView();
     float curX,curY;
        case MotionEvent.ACTION_DOWN :
             mx = event.getX();
             my = event.getY();
       case MotionEvent.ACTION_MOVE :
             curX = event.getX();
             curY = event.getY();
             switcherView.scrollBy((int)(mx - curX),(int)(my - curY));
             mx = curX;
             my = curY;
        case MotionEvent.ACTION_UP :
             curX = event.getX();
             curY = event.getY();
             switcherView.scrollBy((int)(mx - curX),(int)(my - curY));
        return super.onTouchEvent(event);


cannt scroll imageview right and down

by Megha Joshi » Thu, 08 May 2008 06:22:33 GMT

 Using the code that you provided, I can move the Image in any direction on
the screen.
So its working as you expected, isn't it?


Sponsored Links

Other Threads

1. Mobile Hands-on Labs v1.5

I was surfing net for updates and I found Mobile Hands-on Lab v1.5. It
has modules that cover Qt, Web Development and Java Me.  It give an
outline to the module contents, explains the Development Environment,
describes the key aspects of the programming language, also provides
with an optional brief test to check that you have understood the key
Check out this cool link:

It contains a step-by-step guide for creating an application.


2. Google maps Android function

Hello. I am a software developer for Android. I was searching the
internet, but found no answer. I work with Google MAPS and can not
figure out how to implement the following functions in the
1) how to implement the address search on my map?
2) how to pave the closest route to the object that is mapped? With
the help of which you can do to implement a route on the map?
3) I have a large list of addresses (540 pcs.) How to determine
longitude mass and width (to refer to them on the map)?
Nowhere did I find the answers to these questions. I hope for your
help .. Thank you!Waiting with hope the answer ... Thanks again!


3. [ASK] Gallery 3D tidak bisa baca file jpg

4. Is Xoom a Google reference device ?

5. [WTA] Bluetooth Droid X

6. OOT : Happy Birthday Suhi Adinda Erisyanita

7. ImageView drawing cache problem