當前位置: 首頁>>代碼示例>>Java>>正文


Java AbsListView.getChildAt方法代碼示例

本文整理匯總了Java中android.widget.AbsListView.getChildAt方法的典型用法代碼示例。如果您正苦於以下問題:Java AbsListView.getChildAt方法的具體用法?Java AbsListView.getChildAt怎麽用?Java AbsListView.getChildAt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.AbsListView的用法示例。


在下文中一共展示了AbsListView.getChildAt方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isAbsListViewToBottom

import android.widget.AbsListView; //導入方法依賴的package包/類
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);

        BGAStickyNavLayout stickyNavLayout = getStickyNavLayout(absListView);
        if (stickyNavLayout != null) {
            // 處理BGAStickyNavLayout中lastChild.getBottom() <= absListView.getMeasuredHeight()失效問題

            // 0表示x,1表示y
            int[] location = new int[2];
            lastChild.getLocationOnScreen(location);
            int lastChildBottomOnScreen = location[1] + lastChild.getMeasuredHeight();
            stickyNavLayout.getLocationOnScreen(location);
            int stickyNavLayoutBottomOnScreen = location[1] + stickyNavLayout.getMeasuredHeight();
            return lastChildBottomOnScreen + absListView.getPaddingBottom() <= stickyNavLayoutBottomOnScreen;
        } else {
            return lastChild.getBottom() <= absListView.getMeasuredHeight();
        }
    }
    return false;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:22,代碼來源:BGARefreshScrollingUtil.java

示例2: canChildScrollDown

import android.widget.AbsListView; //導入方法依賴的package包/類
public boolean canChildScrollDown() {
    if (android.os.Build.VERSION.SDK_INT < 14) {
        if (mTarget instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) mTarget;
            View lastChild = absListView.getChildAt(absListView.getChildCount() - 1);
            if (lastChild != null) {
                return (absListView.getLastVisiblePosition() == (absListView.getCount() - 1))
                        && lastChild.getBottom() > absListView.getPaddingBottom();
            } else {
                return false;
            }
        } else {
            return mTarget.getHeight() - mTarget.getScrollY() > 0;
        }
    } else {
        return ViewCompat.canScrollVertically(mTarget, 1);
    }
}
 
開發者ID:838030195,項目名稱:DaiGo,代碼行數:19,代碼來源:PullRefreshLayout.java

示例3: onScrollToTopOrBottom

import android.widget.AbsListView; //導入方法依賴的package包/類
private void onScrollToTopOrBottom(AbsListView view) {
    View childAt = view.getChildAt(0);
    if (childAt == null) {
        return;
    }
    //滑動到頂部
    if (view.getFirstVisiblePosition() == 0 &&
            childAt.getTop() >= 0) {
    //It is scrolled all the way up here
        if (mScrollChangeListener != null) {
            mScrollChangeListener.onScrollToTop();
        }
    }

    //滑動到底部
    if (view.getLastVisiblePosition() == view.getAdapter().getCount() - 1 &&
            view.getChildAt(
                    view.getChildCount() - 1).getBottom() <= view.getHeight()) {
        if (mScrollChangeListener != null) {
            mScrollChangeListener.onScrollToBottom();
        }
    }
}
 
開發者ID:hetianpeng,項目名稱:shareApk,代碼行數:24,代碼來源:CalculatorOnScrollListener.java

示例4: onScroll

import android.widget.AbsListView; //導入方法依賴的package包/類
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
    final View topChild = view.getChildAt(0);
    int firstViewTop = 0;
    if (topChild != null) {
        firstViewTop = topChild.getTop();
    }
    boolean goingDown;
    boolean changed = true;
    if (mPrevPosition == firstVisibleItem) {
        final int topDelta = mPrevTop - firstViewTop;
        goingDown = firstViewTop < mPrevTop;
        changed = Math.abs(topDelta) > DIRECTION_CHANGE_THRESHOLD;
    } else {
        goingDown = firstVisibleItem > mPrevPosition;
    }
    if (changed && mUpdated) {
        mFloatingActionButton.hide(goingDown);
    }
    mPrevPosition = firstVisibleItem;
    mPrevTop = firstViewTop;
    mUpdated = true;
}
 
開發者ID:ujjwalagrawal17,項目名稱:CodeCompilerApp,代碼行數:24,代碼來源:DirectionScrollListener.java

示例5: updateListViewScrollState

import android.widget.AbsListView; //導入方法依賴的package包/類
private void updateListViewScrollState(AbsListView listView) {
    if (listView.getChildCount() == 0) {
        setDraggable(true);
    } else {
        if (listView.getFirstVisiblePosition() == 0) {
            View firstChild = listView.getChildAt(0);
            if (firstChild.getTop() == listView.getPaddingTop()) {
                setDraggable(true);
                return;
            }
        }
        setDraggable(false);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:ScrollLayout.java

示例6: isAbsListViewToBottom

import android.widget.AbsListView; //導入方法依賴的package包/類
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;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:9,代碼來源:ScrollingUtil.java

示例7: onScroll

import android.widget.AbsListView; //導入方法依賴的package包/類
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
       SimpleMonthView child = (SimpleMonthView) view.getChildAt(0);
       if (child == null) {
           return;
       }

       // Figure out where we are
       long currScroll = view.getFirstVisiblePosition() * child.getHeight() - child.getBottom();
       mPreviousScrollPosition = currScroll;
       mPreviousScrollState = mCurrentScrollState;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:12,代碼來源:DayPickerView.java

示例8: onScroll

import android.widget.AbsListView; //導入方法依賴的package包/類
/**
 * Updates the title and selected month if the view has moved to a new
 * month.
 */
@Override
public void onScroll(
        AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
    MonthView child = (MonthView) view.getChildAt(0);
    if (child == null) {
        return;
    }

    // Figure out where we are
    long currScroll = view.getFirstVisiblePosition() * child.getHeight() - child.getBottom();
    mPreviousScrollPosition = currScroll;
    mPreviousScrollState = mCurrentScrollState;
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:18,代碼來源:DayPickerView.java

示例9: isScrollTop

import android.widget.AbsListView; //導入方法依賴的package包/類
/**
 * ContentView是否滾動到頂部
 */
private boolean isScrollTop() {
    if (mContentView instanceof RecyclerView)
        return ((RecyclerView) mContentView).computeVerticalScrollOffset() == 0;
    if (mContentView instanceof AbsListView) {
        boolean result = false;
        AbsListView listView = (AbsListView) mContentView;
        if (listView.getFirstVisiblePosition() == 0) {
            final View topChildView = listView.getChildAt(0);
            result = topChildView.getTop() == 0;
        }
        return result;
    }
    return mContentView.getScrollY() == 0;
}
 
開發者ID:yhyonghao,項目名稱:CalendarView_master,代碼行數:18,代碼來源:CalendarLayout.java

示例10: getScroll

import android.widget.AbsListView; //導入方法依賴的package包/類
/**
 * 獲取View的滑動距離
 *
 * @param view
 * @return
 */
private int getScroll(AbsListView view) {
    View c = view.getChildAt(0); //this is the first visible row
    if (c == null) {
        return 0;
    }
    int scrollY = -c.getTop();
    listViewItemHeights.put(view.getFirstVisiblePosition(), c.getHeight());
    for (int i = 0; i < view.getFirstVisiblePosition(); ++i) {
        if (listViewItemHeights.get(i) != null) // (this is a sanity check)
            scrollY += listViewItemHeights.get(i); //add all heights of the views that are gone
    }
    return scrollY;
}
 
開發者ID:hetianpeng,項目名稱:shareApk,代碼行數:20,代碼來源:CalculatorOnScrollListener.java

示例11: onScroll

import android.widget.AbsListView; //導入方法依賴的package包/類
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int endFadeItem) {
    if (mTransparentEnabled && firstVisibleItem <= endFadeItem) {
        View v = view.getChildAt(0);
        // Top of visible window, originally 0, turn to negative when scroll to lower position
        int top = (v == null) ? 0 : v.getTop();
        // distance from top of current window to ending position of fade
        int delta = top + mEndFadePosition - 4;
        mAlpha = interpolate(delta);
        setTitleBarTranslate(mAlpha);

    }
}
 
開發者ID:wzx54321,項目名稱:XinFramework,代碼行數:14,代碼來源:TitleBar.java

示例12: onScroll

import android.widget.AbsListView; //導入方法依賴的package包/類
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
                     int visibleItemCount, int totalItemCount) {
    SimpleMonthView child = (SimpleMonthView) view.getChildAt(0);
    if (child == null) {
        return;
    }

    // Figure out where we are
    long currScroll = view.getFirstVisiblePosition() * child.getHeight()
            - child.getBottom();
    mPreviousScrollPosition = currScroll;
    mPreviousScrollState = mCurrentScrollState;
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:15,代碼來源:DayPickerView.java

示例13: isAbsListViewToBottom

import android.widget.AbsListView; //導入方法依賴的package包/類
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  true;
    }
    return false;
}
 
開發者ID:yanyiqun001,項目名稱:goRefresh,代碼行數:10,代碼來源:ScrollingUtil.java

示例14: onScroll

import android.widget.AbsListView; //導入方法依賴的package包/類
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
    View firstChild = view.getChildAt(0);
    if (firstChild == null) {
        return;
    }
    int top = firstChild.getTop();
    int height = firstChild.getHeight();
    int delta;
    int skipped = 0;
    if (lastFirstVisibleItem == firstVisibleItem) {
        delta = lastTop - top;
    } else if (firstVisibleItem > lastFirstVisibleItem) {
        skipped = firstVisibleItem - lastFirstVisibleItem - 1;
        delta = skipped * height + lastHeight + lastTop - top;
    } else {
        skipped = lastFirstVisibleItem - firstVisibleItem - 1;
        delta = skipped * -height + lastTop - (height + top);
    }
    boolean exact = skipped > 0;
    scrollPosition += -delta;
    if (listener != null) {
        listener.onScrollUpDownChanged(-delta, scrollPosition, exact);
    }
    lastFirstVisibleItem = firstVisibleItem;
    lastTop = top;
    lastHeight = firstChild.getHeight();
}
 
開發者ID:Dnet3,項目名稱:CustomAndroidOneSheeld,代碼行數:29,代碼來源:ListViewScrollObserver.java

示例15: onScroll

import android.widget.AbsListView; //導入方法依賴的package包/類
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
    View childAt = view.getChildAt(0);
    if (childAt == null)
        return;
    int scrollY = firstVisibleItem * childAt.getHeight() - childAt.getTop();
    if (scrollY <= (mScreenHeight / 3f)) {
        float alpha = 1f - (scrollY / (mScreenHeight / 3f));
        Log.e("CSDN_LQR", "scrollY = " + scrollY);
        Log.e("CSDN_LQR", "alpha = " + alpha);
        mToolbar.setAlpha(alpha);
    }
}
 
開發者ID:GitLqr,項目名稱:MaterialDesignDemo,代碼行數:14,代碼來源:TransparentToolbarActivity.java


注:本文中的android.widget.AbsListView.getChildAt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。