2

First of all, I'm aware that I'm breaking UI guidelines. My app is more of a fun UI than an actual production quality app. Having the UI not work exactly like the rest of Android is pretty much the whole point.

So, my app has a ListView of text items. Nothing complicated there. The trick is that I want the list to move like it's ratcheted. Basically, if you scroll up enough, it advances one full step to make the next list item appear. It would not show the animation that slowly scrolls the next item up from the bottom. Does that make sense?

I made a custom view that's basically just a LinearLayout that updates the text as you scroll, but by doing that, I lose all of the extra functionality of the ListView (scroll, fling, seletedItem, etc) and I had to reimplement those features myself (poorly). I could not find a method in the API that would allow it to only scroll by full steps. Any suggestions would be appreciated.

Edit: I just noticed the LayoutAnimationController. At first glance, this may be what I need, but I'm not sure yet, and I certainly have no idea how to use it.

4

1 回答 1

0

尝试:

listView.setOnScrollListener(new OnScrollListener() {

        @Override
        public void onScrollStateChanged(AbsListView view, int scrollState) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onScroll(AbsListView view, int firstVisibleItem,
                int visibleItemCount, int totalItemCount) {
            listView.setSelection(firstVisibleItem);

        }
    });
于 2013-06-24T21:18:29.027 回答