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


Java AbsListView.getAdapter方法代码示例

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


在下文中一共展示了AbsListView.getAdapter方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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包/类
/**
 * 判断View是否可以下拉
 * @return canChildScrollDown
 */
public boolean canChildScrollDown() {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        if (mTargetView instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) mTargetView;
            return absListView.getChildCount() > 0 && absListView.getAdapter() != null
                    && (absListView.getLastVisiblePosition() < absListView.getAdapter().getCount() - 1 || absListView.getChildAt(absListView.getChildCount() - 1)
                    .getBottom() < absListView.getPaddingBottom());
        } else {
            return ViewCompat.canScrollVertically(mTargetView, 1) || mTargetView.getScrollY() > 0;
        }
    } else {
        return ViewCompat.canScrollVertically(mTargetView, 1);
    }
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:19,代码来源:SlidingLayout.java

示例3: 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

示例4: scrollToBottom

import android.widget.AbsListView; //导入方法依赖的package包/类
public static void scrollToBottom(final AbsListView absListView) {
    if (absListView != null) {
        if (absListView.getAdapter() != null && absListView.getAdapter().getCount() > 0) {
            absListView.post(new Runnable() {
                @Override
                public void run() {
                    absListView.setSelection(absListView.getAdapter().getCount() - 1);
                }
            });
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:ScrollingUtil.java

示例5: shouldHandleAbsListViewLoadingMore

import android.widget.AbsListView; //导入方法依赖的package包/类
public boolean shouldHandleAbsListViewLoadingMore(AbsListView absListView) {
    if (mIsLoadingMore || mCurrentRefreshStatus == RefreshStatus.REFRESHING || mLoadMoreFooterView == null || mDelegate == null || absListView == null || absListView.getAdapter() == null || absListView.getAdapter().getCount() == 0) {
        return false;
    }

    return BGARefreshScrollingUtil.isAbsListViewToBottom(absListView);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:BGARefreshLayout.java

示例6: canChildScrollDown

import android.widget.AbsListView; //导入方法依赖的package包/类
/**
 * 判断View是否可以下拉
 * @return canChildScrollDown
 */
public boolean canChildScrollDown() {
    if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        if (mTargetView instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) mTargetView;
            return absListView.getChildCount() > 0 && absListView.getAdapter() != null
                    && (absListView.getLastVisiblePosition() < absListView.getAdapter().getCount() - 1 || absListView.getChildAt(absListView.getChildCount() - 1)
                    .getBottom() < absListView.getPaddingBottom());
        } else {
            return ViewCompat.canScrollVertically(mTargetView, 1) || mTargetView.getScrollY() > 0;
        }
    } else {
        return ViewCompat.canScrollVertically(mTargetView, 1);
    }
}
 
开发者ID:stytooldex,项目名称:stynico,代码行数:19,代码来源:SlidingLayout.java

示例7: 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

示例8: scrollListViewToBottom

import android.widget.AbsListView; //导入方法依赖的package包/类
public static void scrollListViewToBottom(final AbsListView absListView) {
    if (absListView != null && absListView.getAdapter() != null && ((ListAdapter) absListView
            .getAdapter()).getCount() > 0) {
        absListView.post(new Runnable() {
            public void run() {
                absListView.setSelection(((ListAdapter) absListView.getAdapter()).getCount()
                        - 1);
            }
        });
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:12,代码来源:MQUtils.java

示例9: isViewBeingDragged

import android.widget.AbsListView; //导入方法依赖的package包/类
public boolean isViewBeingDragged(MotionEvent event, AbsListView view) {
    if (view.getAdapter() == null || ((ListAdapter) view.getAdapter()).isEmpty()) {
        return true;
    }
    view.getLocationOnScreen(this.mViewLocationResult);
    int viewLeft = this.mViewLocationResult[0];
    int viewTop = this.mViewLocationResult[1];
    this.mRect.set(viewLeft, viewTop, view.getWidth() + viewLeft, view.getHeight() + viewTop);
    int rawX = (int) event.getRawX();
    int rawY = (int) event.getRawY();
    return this.mRect.contains(rawX, rawY) ? isReadyForPull(view, (float) (rawX - this.mRect
            .left), (float) (rawY - this.mRect.top)) : false;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:14,代码来源:AbsListViewDelegate.java

示例10: canChildScrollDown

import android.widget.AbsListView; //导入方法依赖的package包/类
public static boolean canChildScrollDown(View view) {
    if (view instanceof AbsListView) {
        final AbsListView absListView = (AbsListView) view;
        if (Build.VERSION.SDK_INT < 14) {
            return absListView.getChildCount() == 0
                    || absListView.getAdapter() == null
                    || (absListView.getChildCount() > 0
                    && (absListView.getLastVisiblePosition() < absListView.getAdapter().getCount() - 1)
                    || absListView.getChildAt(absListView.getChildCount() - 1).getBottom()
                    > absListView.getHeight() - absListView.getPaddingBottom());
        } else {
            if (Build.VERSION.SDK_INT < 26)
                return absListView.getChildCount() == 0 ||
                        ViewCompat.canScrollVertically(view, 1);
            else
                return absListView.getChildCount() == 0 ||
                        view.canScrollVertically(1);
        }
    } else if (view instanceof ScrollView) {
        final ScrollView scrollView = (ScrollView) view;
        if (Build.VERSION.SDK_INT < 14) {
            return scrollView.getChildCount() == 0
                    || (scrollView.getChildCount() != 0
                    && scrollView.getScrollY() < scrollView.getChildAt(0).getHeight()
                    - scrollView.getHeight());
        } else {
            if (Build.VERSION.SDK_INT < 26)
                return scrollView.getChildCount() == 0 ||
                        ViewCompat.canScrollVertically(view, 1);
            else
                return scrollView.getChildCount() == 0 ||
                        view.canScrollVertically(1);
        }
    } else {
        try {
            if (view instanceof RecyclerView) {
                final RecyclerView recyclerView = (RecyclerView) view;
                if (Build.VERSION.SDK_INT < 26)
                    return recyclerView.getChildCount() == 0 ||
                            ViewCompat.canScrollVertically(view, 1);
                else
                    return recyclerView.getChildCount() == 0 ||
                            view.canScrollVertically(1);
            }
        } catch (NoClassDefFoundError e) {
            e.printStackTrace();
        }
        if (Build.VERSION.SDK_INT < 26)
            return ViewCompat.canScrollVertically(view, 1);
        else
            return view.canScrollVertically(1);
    }
}
 
开发者ID:dkzwm,项目名称:SmoothRefreshLayout,代码行数:54,代码来源:ScrollCompat.java

示例11: onScroll

import android.widget.AbsListView; //导入方法依赖的package包/类
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int
        totalItemCount) {
    if (PinnedSectionListView.this.mDelegateOnScrollListener != null) {
        PinnedSectionListView.this.mDelegateOnScrollListener.onScroll(view,
                firstVisibleItem, visibleItemCount, totalItemCount);
    }
    if (((PinnedSectionListAdapter) view.getAdapter()) != null && visibleItemCount != 0) {
        int visibleSectionPosition = PinnedSectionListView.this
                .findFirstVisibleSectionPosition(firstVisibleItem, visibleItemCount);
        if (visibleSectionPosition == -1) {
            int currentSectionPosition = PinnedSectionListView.this
                    .findCurrentSectionPosition(firstVisibleItem);
            if (currentSectionPosition != -1) {
                if (PinnedSectionListView.this.mPinnedShadow != null) {
                    if (PinnedSectionListView.this.mPinnedShadow.position ==
                            currentSectionPosition) {
                        PinnedSectionListView.this.mTranslateY = 0;
                        return;
                    }
                    PinnedSectionListView.this.destroyPinnedShadow();
                }
                PinnedSectionListView.this.createPinnedShadow(currentSectionPosition);
                return;
            }
            return;
        }
        int visibleSectionTop = view.getChildAt(visibleSectionPosition -
                firstVisibleItem).getTop();
        int topBorder = PinnedSectionListView.this.getListPaddingTop();
        if (PinnedSectionListView.this.mPinnedShadow == null) {
            if (visibleSectionTop < topBorder) {
                PinnedSectionListView.this.createPinnedShadow(visibleSectionPosition);
            }
        } else if (visibleSectionPosition != PinnedSectionListView.this.mPinnedShadow
                .position) {
            int pinnedSectionBottom = topBorder + PinnedSectionListView.this
                    .mPinnedShadow.view.getHeight();
            if (visibleSectionTop >= pinnedSectionBottom) {
                PinnedSectionListView.this.mTranslateY = 0;
            } else if (visibleSectionTop < topBorder) {
                PinnedSectionListView.this.destroyPinnedShadow();
                PinnedSectionListView.this.createPinnedShadow(visibleSectionPosition);
            } else {
                PinnedSectionListView.this.mTranslateY = visibleSectionTop -
                        pinnedSectionBottom;
            }
        } else if (visibleSectionTop > topBorder) {
            PinnedSectionListView.this.destroyPinnedShadow();
            visibleSectionPosition = PinnedSectionListView.this
                    .findCurrentSectionPosition(visibleSectionPosition - 1);
            if (visibleSectionPosition > -1) {
                PinnedSectionListView.this.createPinnedShadow(visibleSectionPosition);
                int translateY = (visibleSectionTop - topBorder) - PinnedSectionListView
                        .this.mPinnedShadow.view.getHeight();
                if (translateY > 0) {
                    translateY = 0;
                }
                PinnedSectionListView.this.mTranslateY = translateY;
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:63,代码来源:PinnedSectionListView.java


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