lt;已解决>scrollview怎么默认设置显示底部试图
1个回答
展开全部
1、判断是否已经滚动到顶部或底部,代码如下:
private void doOnBorderListener() {
if (contentView != null && contentView.getMeasuredHeight() <= getScrollY() + getHeight()) {
if (onBorderListener != null) {
onBorderListener.onBottom();
}
} else if (getScrollY() == 0) {
if (onBorderListener != null) {
onBorderListener.onTop();
}
}
}
滚动到顶部判断:getScrollY() == 0
滚动到底部判断
View contentView = getChildAt(0);
contentView.getMeasuredHeight() <= getScrollY() + getHeight();
private void doOnBorderListener() {
if (contentView != null && contentView.getMeasuredHeight() <= getScrollY() + getHeight()) {
if (onBorderListener != null) {
onBorderListener.onBottom();
}
} else if (getScrollY() == 0) {
if (onBorderListener != null) {
onBorderListener.onTop();
}
}
}
滚动到顶部判断:getScrollY() == 0
滚动到底部判断
View contentView = getChildAt(0);
contentView.getMeasuredHeight() <= getScrollY() + getHeight();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询