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


Java AbsListView.getHeight方法代码示例

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


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

示例1: absListViewCanScrollList

import android.widget.AbsListView; //导入方法依赖的package包/类
/**
 * Copy From AbsListView (API Level >= 19)
 * @param absListView AbsListView
 * @param direction Negative to check scrolling up, positive to check
 *                  scrolling down.
 * @return true if the list can be scrolled in the specified direction,
 *         false otherwise
 */
private boolean absListViewCanScrollList(AbsListView absListView,int direction) {
    final int childCount = absListView.getChildCount();
    if (childCount == 0) {
        return false;
    }
    final int firstPosition = absListView.getFirstVisiblePosition();
    if (direction > 0) {//can scroll down
        final int lastBottom = absListView.getChildAt(childCount - 1).getBottom();
        final int lastPosition = firstPosition + childCount;
        return lastPosition < absListView.getCount() || lastBottom > absListView.getHeight() - absListView.getPaddingTop();
    } else {//can scroll  up
        final int firstTop = absListView.getChildAt(0).getTop();
        return firstPosition > 0 || firstTop < absListView.getPaddingTop();
    }
}
 
开发者ID:stytooldex,项目名称:pius1,代码行数:24,代码来源:SlideBottomPanel.java

示例2: canChildScrollDown

import android.widget.AbsListView; //导入方法依赖的package包/类
/**
 * 是否能上拉
 *
 * @return
 */
private boolean canChildScrollDown() {
    if (checkListener != null) {
        return checkListener.canScrollDown();
    }
    if (android.os.Build.VERSION.SDK_INT < 14) {
        if (child instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) child;
            return absListView.getChildCount() > 0
                    && (absListView.getLastVisiblePosition() < absListView.getChildCount() - 1
                    || absListView.getChildAt(absListView.getChildCount() - 1).getBottom() > absListView.getHeight() - absListView.getPaddingBottom());
        }
    }
    return ViewCompat.canScrollVertically(child, 1);

}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:21,代码来源:OverScrollLayout.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: canChildScrollDown

import android.widget.AbsListView; //导入方法依赖的package包/类
@Override
protected boolean canChildScrollDown() {
    if (android.os.Build.VERSION.SDK_INT < 14) {
        if (mTarget instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) mTarget;
            return absListView.getChildCount() > 0
                    && (absListView.getLastVisiblePosition() < absListView.getCount() - 1 ||
                    absListView.getChildAt(absListView.getChildCount() - 1).getBottom() >
                            absListView.getHeight() - absListView.getPaddingBottom());
        } else {
            return ViewCompat.canScrollVertically(mTarget, 1);
        }
    } else {
        return ViewCompat.canScrollVertically(mTarget, 1);
    }
}
 
开发者ID:tohodog,项目名称:QSRefreshLayout,代码行数:17,代码来源:QSRefreshLayout.java

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


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