@Override public void onScrollStateChanged(AbsListView view, int scrollState) { super.onScrollStateChanged(view, scrollState); if (scrollState == SCROLL_STATE_IDLE) { // 停止滑动,日期指示器消失 mTimeLineText.setVisibility(View.GONE); } else if (scrollState == SCROLL_STATE_FLING) { mTimeLineText.setVisibility(View.VISIBLE); } }
@Override public void onScroll( AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { super.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); if (mTimeLineText.getVisibility() == View.VISIBLE) { int index = firstVisibleItem + 1 == view.getAdapter().getCount() ? view.getAdapter().getCount() - 1 : firstVisibleItem + 1; Image image = (Image) view.getAdapter().getItem(index); if (image != null) { mTimeLineText.setText(TimeUtil.formatPhotoDate(image.path)); } } }