当前位置: 首页>>代码示例>>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;未经允许,请勿转载。