当前位置: 首页>>代码示例>>Java>>正文


Java ScrollView.getChildAt方法代码示例

本文整理汇总了Java中android.widget.ScrollView.getChildAt方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollView.getChildAt方法的具体用法?Java ScrollView.getChildAt怎么用?Java ScrollView.getChildAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.ScrollView的用法示例。


在下文中一共展示了ScrollView.getChildAt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: canScroll

import android.widget.ScrollView; //导入方法依赖的package包/类
static boolean canScroll(View view) {
    if (view instanceof ScrollView) {
        ScrollView scrollView = (ScrollView) view;
        View child = scrollView.getChildAt(0);
        if (child != null) {
            int childHeight = child.getHeight();
            return scrollView.getHeight() < childHeight + scrollView.getPaddingTop() + scrollView.getPaddingBottom();
        }
        return false;
    } else if (view instanceof RecyclerView) {
        RecyclerView recyclerView = (RecyclerView) view;
        int yOffset = recyclerView.computeVerticalScrollOffset();
        return yOffset != 0;
    }
    return true;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:Utils.java

示例2: canChildPullUp

import android.widget.ScrollView; //导入方法依赖的package包/类
public boolean canChildPullUp() {
    if (child instanceof AbsListView) {
        AbsListView absListView = (AbsListView) child;
        return canScrollVertically(child, 1)
                || absListView.getLastVisiblePosition() != mTotalItemCount - 1;
    } else if (child instanceof WebView) {
        WebView webview = (WebView) child;
        if (webview instanceof XWebView) {
            return !((XWebView) webview).isBottom();
        } else {
            float left = webview.getContentHeight() * webview.getScale();
            int right = webview.getHeight() + webview.getScrollY();
            return left != right;
        }
    } else if (child instanceof ScrollView) {
        ScrollView scrollView = (ScrollView) child;
        View childView = scrollView.getChildAt(0);
        if (childView != null) {
            return canScrollVertically(child, 1)
                    || scrollView.getScrollY() < childView.getHeight() - scrollView.getHeight();
        }
    } else {
        return canScrollVertically(child, 1);
    }
    return true;
}
 
开发者ID:LonelyMushroom,项目名称:aarLibrary,代码行数:27,代码来源:XRefreshContentView.java

示例3: isAtBottom

import android.widget.ScrollView; //导入方法依赖的package包/类
private boolean isAtBottom() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        return !ViewCompat.canScrollVertically(mTarget, 1);
    } else {
        if (mTarget instanceof RecyclerView) {
            return SuperSwipeHelper.isAtBottom((RecyclerView) mTarget);
        } else if (mTarget instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) mTarget;
            int count = absListView.getAdapter().getCount();
            int firstPos = absListView.getFirstVisiblePosition();
            if (firstPos == 0
                    && absListView.getChildAt(0).getTop() >= absListView
                    .getPaddingTop()) {
                return false;
            }
            int lastPos = absListView.getLastVisiblePosition();
            if (lastPos > 0 && count > 0 && lastPos == count - 1) {
                return true;
            }
            return false;
        } else if (mTarget instanceof ScrollView) {
            ScrollView scrollView = (ScrollView) mTarget;
            View view = (View) scrollView
                    .getChildAt(scrollView.getChildCount() - 1);
            if (view != null) {
                int diff = (view.getBottom() - (scrollView.getHeight() + scrollView
                        .getScrollY()));
                if (diff == 0) {
                    return true;
                }
            }
        }
        return false;
    }
}
 
开发者ID:FreeSunny,项目名称:Amazing,代码行数:36,代码来源:SuperSwipeRefreshLayout.java

示例4: svPullUpIntercept

import android.widget.ScrollView; //导入方法依赖的package包/类
public boolean svPullUpIntercept(View child) {
    boolean intercept = false;
    ScrollView scrollView = (ScrollView) child;
    View scrollChild = scrollView.getChildAt(0);

    if (scrollView.getScrollY() >= (scrollChild.getHeight() - scrollView.getHeight())) {
        intercept = true;
    }
    return intercept;
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:11,代码来源:InterceptLayout.java


注:本文中的android.widget.ScrollView.getChildAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。