美文网首页
判断listview是否滑动到顶部

判断listview是否滑动到顶部

作者: 4528283108ee | 来源:发表于2015-08-06 08:30 被阅读1069次

     

    /**

    *@returnWhether it is possible for the child view of this layout to

    *         scroll up. Override this if the child view is a custom view.

    */

    public boolean canChildScrollUp() {

    if (android.os.Build.VERSION.SDK_INT < 14) {

    if (mTarget instanceof AbsListView) {

    final AbsListView absListView = (AbsListView) mTarget;

    return absListView.getChildCount() > 0 &&

    (absListView.getFirstVisiblePosition() > 0 ||

    absListView.getChildAt(0).getTop() < absListView.getPaddingTop());

    } else {

    return ViewCompat.canScrollVertically(mTarget, -1) || mTarget.getScrollY() > 0;

    }

    } else {

    return ViewCompat.canScrollVertically(mTarget, -1);

    }

    }

    相关文章

      网友评论

          本文标题:判断listview是否滑动到顶部

          本文链接:https://www.haomeiwen.com/subject/lyxbqttx.html