如何在Google +中实现滑动应用和向下滑动,我需要在片段中添加内容。任何想法?
答案 0 :(得分:0)
我有2个解决方案:
你可以自己做。触发Listview或Gridview的onScrollListener
listview.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
if (view.getId() == listview.getId()) {
final int currentFirstVisibleItem = mGrid.getFirstVisiblePosition();
if (currentFirstVisibleItem > mLastFirstVisibleItem) {
Log.i("a", "scrolling down...");
if (mIsScrollingUp) {
mIsScrollingUp = false;
bottomView.setTranslationY(bottomHeight);
}
} else if (currentFirstVisibleItem < mLastFirstVisibleItem) {
Log.i("a", "scrolling up...");
if (!mIsScrollingUp) {
mIsScrollingUp = true;
bottomView.setTranslationY(0);
}
}
mLastFirstVisibleItem = currentFirstVisibleItem;
}
}
如果我的代码错误,请告诉我