Hi!
I'm here again because I have some problems.
I want to have a scrollview after fling callback, but I don't find
anything on the web talking about it.
I explain; I have to do a scrollview containing paging. When the page
separator ( it can be a textview, or something like that ) is on the
first half of the screen, the scrollview must be scrolled and the
separator must be at the top of the screen.
Here is my code, but have some problems with fling :

// mMarkers is a array of View containing pages separators
// mCurrentView is the indice of the current page

@Override
public boolean onTouchEvent(MotionEvent ev) {
   int location[] = new int[2];
   // if next page is the most visible
   if((mCurrentView +1) < mMarkers.length) {
        mMarkers[mCurrentView +1].getLocationOnScreen(location);
        if((location[Y] - mScreenHeight/2) < 0) {
                scrollTo(0, getScrollY() + location[1] - 55);
                ++mCurrentView;
                return true;
        }
   }
   // if previous page is the most visible
   if((mCurrentView -1) >= 0) {
        mMarkers[mCurrentView -1].getLocationOnScreen(location);
        if((location[Y] + mScreenHeight/2) > 0) {
                scrollTo(0, getScrollY() + location[1] - 55);
                --mCurrentView;
                return true;
        }
   }
   return super.onTouchEvent(ev);
}

So is it a good approach or not ? How can I do that else ?
Thanks a lot in advance!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to