Does SmoothScrollToPosition () only scroll part in Android ICS?

In Gingerbread, I had no problem using smoothScrollToPosition () to scroll through dozens of items at a time. After my Nexus S was upgraded to Ice Cream Sandwich, I noticed that no matter what I entered in smoothScrollToPosition (), it will only scroll a couple of hundred pixels in any direction, and then stop.

Is this a known issue with ICS? I noticed this with the Galaxy Nexus. I looked at a few other questions and tried several different tricks, for example, turning off notifyDataSetChanged () calls and posting smoothScrollToPosition () as a delayed runnable, but unfortunately it does not want to scroll more than a hundred pixels or so to a stop .: (

+5
source share
5 answers

There is a problem with the duration required to complete the animation, the same problem is present with smoothScrollBy (int distance, int duration), at a glance smoothScrollToPosition () is a friendly shell around smoothScrollBy () that does a lot of work. smoothScrollBy (), in turn, pretends to be a "running gesture", as if the user made a movement.

smoothScrollBy , . , , , , , , , . ( , , , , , ).

Android , run() , ListView () , , . , Android , , , .

, , - :)

, , , , smoothScrollBy() X. , bigstones, - SCROLL_DURATION 1000 . ICS , 2.2, .

runnables , .

+12

, . , smoothscrolling, ( , 0).

//There is a known bug where smoothScrollToPosition(..) may not reach the top, 
            //if the list is very large, keep scrolling until you reach the top element
            newsFeed.setOnScrollListener(new OnScrollListener() {
                @Override
                public void onScrollStateChanged(AbsListView view, int scrollState) {

                }

                @Override
                public void onScroll(AbsListView view, int firstVisibleItem,
                        int visibleItemCount, int totalItemCount) {
                    if(firstVisibleItem != 0) {
                        newsFeed.smoothScrollToPosition(0);
                    } 
                    else {
                        //We are done
                        newsFeed.setOnScrollListener(null);
                    }
                }
            });
            newsFeed.smoothScrollToPosition(0);
+2

- , smoothScrollToPositionFromTop(0,0). .

+2

ListView getChildCount(), AbsListView.java. ListView getChildCount() . , setSelection().

0

ICS.

, , , . , notifyDataSetChanged(), smoothScrollToPosition(). Android . ICS . , 3 . , . → . , , . Google . , , listview, (1px) , , .

0
source

All Articles