Java Code Examples for android.widget.AbsListView#getMeasuredHeight()

The following examples show how to use android.widget.AbsListView#getMeasuredHeight() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WXSwipeLayout.java    From ucar-weex-core with Apache License 2.0 6 votes vote down vote up
/**
 * Whether child view can scroll down
 * @return
 */
public boolean canChildScrollDown() {
  if (mTargetView == null) {
    return false;
  }
  if (Build.VERSION.SDK_INT < 14) {
    if (mTargetView instanceof AbsListView) {
      final AbsListView absListView = (AbsListView) mTargetView;
      if (absListView.getChildCount() > 0) {
        int lastChildBottom = absListView.getChildAt(absListView.getChildCount() - 1)
            .getBottom();
        return absListView.getLastVisiblePosition() == absListView.getAdapter().getCount() - 1
               && lastChildBottom <= absListView.getMeasuredHeight();
      } else {
        return false;
      }

    } else {
      return ViewCompat.canScrollVertically(mTargetView, 1) || mTargetView.getScrollY() > 0;
    }
  } else {
    return ViewCompat.canScrollVertically(mTargetView, 1);
  }
}
 
Example 2
Source File: WXSwipeLayout.java    From weex-uikit with MIT License 6 votes vote down vote up
/**
 * Whether child view can scroll down
 * @return
 */
public boolean canChildScrollDown() {
  if (mTargetView == null) {
    return false;
  }
  if (Build.VERSION.SDK_INT < 14) {
    if (mTargetView instanceof AbsListView) {
      final AbsListView absListView = (AbsListView) mTargetView;
      if (absListView.getChildCount() > 0) {
        int lastChildBottom = absListView.getChildAt(absListView.getChildCount() - 1)
            .getBottom();
        return absListView.getLastVisiblePosition() == absListView.getAdapter().getCount() - 1
               && lastChildBottom <= absListView.getMeasuredHeight();
      } else {
        return false;
      }

    } else {
      return ViewCompat.canScrollVertically(mTargetView, 1) || mTargetView.getScrollY() > 0;
    }
  } else {
    return ViewCompat.canScrollVertically(mTargetView, 1);
  }
}
 
Example 3
Source File: MaterialRefreshLayout.java    From SprintNBA with Apache License 2.0 6 votes vote down vote up
public boolean canChildScrollDown() {
    if (mChildView == null) {
        return false;
    }
    if (android.os.Build.VERSION.SDK_INT < 14) {
        if (mChildView instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) mChildView;
            if (absListView.getChildCount() > 0) {
                int lastChildBottom = absListView.getChildAt(absListView.getChildCount() - 1).getBottom();
                return absListView.getLastVisiblePosition() == absListView.getAdapter().getCount() - 1 && lastChildBottom <= absListView.getMeasuredHeight();
            } else {
                return false;
            }

        } else {
            return ViewCompat.canScrollVertically(mChildView, 1) || mChildView.getScrollY() > 0;
        }
    } else {
        return ViewCompat.canScrollVertically(mChildView, 1);
    }
}
 
Example 4
Source File: WXSwipeLayout.java    From weex with Apache License 2.0 6 votes vote down vote up
/**
 * Whether child view can scroll down
 * @return
 */
public boolean canChildScrollDown() {
  if (mTargetView == null) {
    return false;
  }
  if (Build.VERSION.SDK_INT < 14) {
    if (mTargetView instanceof AbsListView) {
      final AbsListView absListView = (AbsListView) mTargetView;
      if (absListView.getChildCount() > 0) {
        int lastChildBottom = absListView.getChildAt(absListView.getChildCount() - 1)
            .getBottom();
        return absListView.getLastVisiblePosition() == absListView.getAdapter().getCount() - 1
               && lastChildBottom <= absListView.getMeasuredHeight();
      } else {
        return false;
      }

    } else {
      return ViewCompat.canScrollVertically(mTargetView, 1) || mTargetView.getScrollY() > 0;
    }
  } else {
    return ViewCompat.canScrollVertically(mTargetView, 1);
  }
}
 
Example 5
Source File: MaterialRefreshLayout.java    From BitkyShop with MIT License 6 votes vote down vote up
public boolean canChildScrollDown() {
    if (mChildView == null) {
        return false;
    }
    if (android.os.Build.VERSION.SDK_INT < 14) {
        if (mChildView instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) mChildView;
            if (absListView.getChildCount() > 0) {
                int lastChildBottom = absListView.getChildAt(absListView.getChildCount() - 1).getBottom();
                return absListView.getLastVisiblePosition() == absListView.getAdapter().getCount() - 1 && lastChildBottom <= absListView.getMeasuredHeight();
            } else {
                return false;
            }

        } else {
            return ViewCompat.canScrollVertically(mChildView, 1) || mChildView.getScrollY() > 0;
        }
    } else {
        return ViewCompat.canScrollVertically(mChildView, 1);
    }
}
 
Example 6
Source File: SHSwipeRefreshLayout.java    From SHSwipeRefreshLayout with MIT License 6 votes vote down vote up
/**
 * Whether child view can scroll down
 * @return
 */
public boolean canChildScrollDown() {
    if (mTargetView == null) {
        return false;
    }
    if (Build.VERSION.SDK_INT < 14) {
        if (mTargetView instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) mTargetView;
            if (absListView.getChildCount() > 0) {
                int lastChildBottom = absListView.getChildAt(absListView.getChildCount() - 1)
                        .getBottom();
                return absListView.getLastVisiblePosition() == absListView.getAdapter().getCount() - 1
                        && lastChildBottom <= absListView.getMeasuredHeight();
            } else {
                return false;
            }

        } else {
            return ViewCompat.canScrollVertically(mTargetView, 1) || mTargetView.getScrollY() > 0;
        }
    } else {
        return ViewCompat.canScrollVertically(mTargetView, 1);
    }
}
 
Example 7
Source File: MaterialRefreshLayout.java    From MousePaint with MIT License 6 votes vote down vote up
public boolean canChildScrollDown() {
    if (mChildView == null) {
        return false;
    }
    if (android.os.Build.VERSION.SDK_INT < 14) {
        if (mChildView instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) mChildView;
            if (absListView.getChildCount()>0)
            {
                int lastChildBottom = absListView.getChildAt(absListView.getChildCount() - 1).getBottom();
                return absListView.getLastVisiblePosition() == absListView.getAdapter().getCount() - 1 && lastChildBottom <= absListView.getMeasuredHeight();
            }else
            {
                return false;
            }

        } else {
            return ViewCompat.canScrollVertically(mChildView, 1) || mChildView.getScrollY() > 0;
        }
    } else {
        return ViewCompat.canScrollVertically(mChildView, 1);
    }
}
 
Example 8
Source File: SlideLayout.java    From YCShopDetailLayout with Apache License 2.0 5 votes vote down vote up
protected boolean canListViewScroll(AbsListView absListView) {
    if (mStatus == Status.OPEN) {
        return absListView.getChildCount() > 0
                && (absListView.getFirstVisiblePosition() > 0
                || absListView.getChildAt(0).getTop() < absListView.getPaddingTop());
    } else {
        final int count = absListView.getChildCount();
        return count > 0
                && (absListView.getLastVisiblePosition() < count - 1
                || absListView.getChildAt(count - 1).getBottom() > absListView.getMeasuredHeight());
    }
}
 
Example 9
Source File: SlideAnimLayout.java    From YCShopDetailLayout with Apache License 2.0 5 votes vote down vote up
protected boolean canListViewScroll(AbsListView absListView) {
    if (mStatus == Status.OPEN) {
        return absListView.getChildCount() > 0
                && (absListView.getFirstVisiblePosition() > 0
                || absListView.getChildAt(0).getTop() < absListView.getPaddingTop());
    } else {
        final int count = absListView.getChildCount();
        return count > 0 && (absListView.getLastVisiblePosition() < count - 1
                || absListView.getChildAt(count - 1).getBottom() > absListView.getMeasuredHeight());
    }
}
 
Example 10
Source File: ScrollingUtil.java    From AgentWebX5 with Apache License 2.0 5 votes vote down vote up
public static boolean isAbsListViewToBottom(AbsListView absListView) {
    if (absListView != null && absListView.getAdapter() != null && absListView.getChildCount() > 0 && absListView.getLastVisiblePosition() == absListView.getAdapter().getCount() - 1) {
        View lastChild = absListView.getChildAt(absListView.getChildCount() - 1);

        return lastChild.getBottom() <= absListView.getMeasuredHeight();
    }
    return false;
}
 
Example 11
Source File: ScrollingUtil.java    From TwinklingRefreshLayout with Apache License 2.0 5 votes vote down vote up
public static boolean isAbsListViewToBottom(AbsListView absListView) {
    if (absListView != null && absListView.getAdapter() != null && absListView.getChildCount() > 0 && absListView.getLastVisiblePosition() == absListView.getAdapter().getCount() - 1) {
        View lastChild = absListView.getChildAt(absListView.getChildCount() - 1);

        return lastChild.getBottom() <= absListView.getMeasuredHeight();
    }
    return false;
}
 
Example 12
Source File: BGARefreshLayout.java    From AndroidStudyDemo with GNU General Public License v2.0 5 votes vote down vote up
public boolean shouldHandleAbsListViewLoadingMore(AbsListView absListView) {
    if (mIsLoadingMore || mCurrentRefreshStatus == RefreshStatus.REFRESHING || mLoadMoreFooterView == null || mDelegate == null || absListView == null ||  absListView.getAdapter() == null || absListView.getAdapter().getCount() == 0) {
        return false;
    }

    int lastChildBottom = 0;
    if (absListView.getChildCount() > 0) {
        // 如果AdapterView的子控件数量不为0,获取最后一个子控件的bottom
        lastChildBottom = absListView.getChildAt(absListView.getChildCount() - 1).getBottom();
    }
    return absListView.getLastVisiblePosition() == absListView.getAdapter().getCount() - 1 && lastChildBottom <= absListView.getMeasuredHeight();
}
 
Example 13
Source File: DPullRefreshLayout.java    From Pas with Apache License 2.0 5 votes vote down vote up
/**
 * ListView滚动底部是否
 * @param absListView
 * @return
 */
public boolean shouldHandleAbsListViewLoadingMore(AbsListView absListView) {
    if (mIsLoadingMore || mCurrentRefreshStatus == RefreshStatus.REFRESHING ||
            mLoadMoreFooterView == null || mDelegate == null || absListView == null
            || absListView.getAdapter() == null || absListView.getAdapter().getCount() == 0) {
        return false;
    }

    int lastChildBottom = 0;
    if (absListView.getChildCount() > 0) {
        // 如果AdapterView的子控件数量不为0,获取最后一个子控件的bottom
        lastChildBottom = absListView.getChildAt(absListView.getChildCount() - 1).getBottom();
    }
    return absListView.getLastVisiblePosition() == absListView.getAdapter().getCount() - 1 && lastChildBottom <= absListView.getMeasuredHeight();
}