當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。