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


Java AbsListView.getChildCount方法代码示例

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


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

示例1: canChildScrollUp

import android.widget.AbsListView; //导入方法依赖的package包/类
public boolean canChildScrollUp() {
    boolean z = false;
    if (VERSION.SDK_INT >= 14) {
        return ViewCompat.canScrollVertically(this.mTarget, -1);
    }
    if (this.mTarget instanceof AbsListView) {
        AbsListView absListView = this.mTarget;
        if (absListView.getChildCount() <= 0 || (absListView.getFirstVisiblePosition() <= 0 && absListView.getChildAt(0).getTop() >= absListView.getPaddingTop())) {
            return false;
        }
        return true;
    }
    if (ViewCompat.canScrollVertically(this.mTarget, -1) || this.mTarget.getScrollY() > 0) {
        z = true;
    }
    return z;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:SwipeRefreshLayout.java

示例2: canChildScrollUp

import android.widget.AbsListView; //导入方法依赖的package包/类
/**
     * @return Whether it is possible for the child view of this layout to
     *         scroll up. Override this if the child view is a custom view.
     */
    public boolean canChildScrollUp() {
//        //For make it can work when my recycler view is in Gone.
//        return false;
        if (android.os.Build.VERSION.SDK_INT < 14) {
            if (mTarget instanceof AbsListView) {
                final AbsListView absListView = (AbsListView) mTarget;
                return absListView.getChildCount() > 0
                        && (absListView.getFirstVisiblePosition() > 0 || absListView.getChildAt(0)
                                .getTop() < absListView.getPaddingTop());
            } else {
                return ViewCompat.canScrollVertically(mTarget, -1) || mTarget.getScrollY() > 0;
            }
        } else {
            return ViewCompat.canScrollVertically(mTarget, -1);
        }
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:SwipeRefreshLayout.java

示例3: canChildScrollUp

import android.widget.AbsListView; //导入方法依赖的package包/类
/**
 * 用来判断是否可以下拉
 */
public static boolean canChildScrollUp(View mChildView) {
    if (mChildView == null) {
        return false;
    }
    if (Build.VERSION.SDK_INT < 14) {
        if (mChildView instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) mChildView;
            return absListView.getChildCount() > 0
                    && (absListView.getFirstVisiblePosition() > 0 || absListView.getChildAt(0)
                    .getTop() < absListView.getPaddingTop());
        } else {
            return ViewCompat.canScrollVertically(mChildView, -1) || mChildView.getScrollY() > 0;
        }
    } else {
        return ViewCompat.canScrollVertically(mChildView, -1);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:ScrollingUtil.java

示例4: defaultCanScrollUp

import android.widget.AbsListView; //导入方法依赖的package包/类
public static boolean defaultCanScrollUp(View view) {
    if (view == null) {
        return false;
    }
    if (android.os.Build.VERSION.SDK_INT < 14) {
        if (view instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) view;
            return absListView.getChildCount() > 0
                    && (absListView.getFirstVisiblePosition() > 0 || absListView.getChildAt(0)
                    .getTop() < absListView.getPaddingTop());
        } else {
            return ViewCompat.canScrollVertically(view, -1) || view.getScrollY() > 0;
        }
    } else {
        return ViewCompat.canScrollVertically(view, -1);
    }
}
 
开发者ID:QMUI,项目名称:QMUI_Android,代码行数:18,代码来源:QMUIPullRefreshLayout.java

示例5: canScrollUp

import android.widget.AbsListView; //导入方法依赖的package包/类
public static boolean canScrollUp(View targetView) {
    if (android.os.Build.VERSION.SDK_INT < 14) {
        if (targetView instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) targetView;
            return absListView.getChildCount() > 0
                    && (absListView.getFirstVisiblePosition() > 0 || absListView.getChildAt(0)
                    .getTop() < absListView.getPaddingTop());
        } else {
            return targetView.getScrollY() > 0;
        }
    } else {
        return targetView.canScrollVertically(-1);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:ScrollBoundaryUtil.java

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

示例7: canChildScrollUp

import android.widget.AbsListView; //导入方法依赖的package包/类
/**
 * Whether child view can scroll up
 * @return
 */
public boolean canChildScrollUp() {
  if (mTargetView == null) {
    return false;
  }
  if (Build.VERSION.SDK_INT < 14) {
    if (mTargetView instanceof AbsListView) {
      final AbsListView absListView = (AbsListView) mTargetView;
      return absListView.getChildCount() > 0
             && (absListView.getFirstVisiblePosition() > 0 || absListView.getChildAt(0)
                                                                  .getTop() < absListView.getPaddingTop());
    } else {
      return ViewCompat.canScrollVertically(mTargetView, -1) || mTargetView.getScrollY() > 0;
    }
  } else {
    return ViewCompat.canScrollVertically(mTargetView, -1);
  }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:22,代码来源:WXSwipeLayout.java

示例8: canChildScrollUp

import android.widget.AbsListView; //导入方法依赖的package包/类
public static boolean canChildScrollUp(View view) {
    if (android.os.Build.VERSION.SDK_INT < 14) {
        if (view instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) view;
            return absListView.getChildCount() > 0
                    && (absListView.getFirstVisiblePosition() > 0 || absListView.getChildAt(0)
                    .getTop() < absListView.getPaddingTop());
        } else {
            return view.getScrollY() > 0;
        }
    } else {
        return view.canScrollVertically(-1);
    }
}
 
开发者ID:smartbeng,项目名称:PaoMovie,代码行数:15,代码来源:PtrDefaultHandler.java

示例9: isListViewScrollOnTop

import android.widget.AbsListView; //导入方法依赖的package包/类
private static boolean isListViewScrollOnTop(AbsListView listView) {
    if (listView.getChildCount() == 0) {
        return true;
    }
    if (listView.getFirstVisiblePosition() > 0) {
        return false;
    }
    View topChild = listView.getChildAt(0);
    return topChild.getTop() >= 0;
}
 
开发者ID:kalikov,项目名称:lighthouse,代码行数:11,代码来源:PodcastsActivity.java

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

示例11: canChildScrollDown

import android.widget.AbsListView; //导入方法依赖的package包/类
/**
 * Whether it is possible for the child view of this layout to scroll down. Override this if the child view is a custom view.
 * 判断是否可以上拉
 */
public static boolean canChildScrollDown(View mChildView) {
    if (Build.VERSION.SDK_INT < 14) {
        if (mChildView instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) mChildView;
            return absListView.getChildCount() > 0
                    && (absListView.getLastVisiblePosition() < absListView.getChildCount() - 1
                    || absListView.getChildAt(absListView.getChildCount() - 1).getBottom() > absListView.getPaddingBottom());
        } else {
            return ViewCompat.canScrollVertically(mChildView, 1) || mChildView.getScrollY() < 0;
        }
    } else {
        return ViewCompat.canScrollVertically(mChildView, 1);
    }
}
 
开发者ID:Justson,项目名称:AgentWebX5,代码行数:19,代码来源:ScrollingUtil.java

示例12: canChildScrollUp

import android.widget.AbsListView; //导入方法依赖的package包/类
/**
 * @return Whether it is possible for the child view of this layout to
 * scroll up. Override this if the child view is a custom view.
 */
public boolean canChildScrollUp() {
    if (android.os.Build.VERSION.SDK_INT < 14) {
        if (mTarget instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) mTarget;
            return absListView.getChildCount() > 0
                    && (absListView.getFirstVisiblePosition() > 0 || absListView.getChildAt(0)
                    .getTop() < absListView.getPaddingTop());
        } else {
            return ViewCompat.canScrollVertically(mTarget, -1) || mTarget.getScrollY() > 0;
        }
    } else {
        return ViewCompat.canScrollVertically(mTarget, -1);
    }
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:19,代码来源:LingjuSwipeRefreshLayout.java

示例13: canScrollDown

import android.widget.AbsListView; //导入方法依赖的package包/类
public static boolean canScrollDown(View targetView) {
    if (android.os.Build.VERSION.SDK_INT < 14) {
        if (targetView instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) targetView;
            return absListView.getChildCount() > 0
                    && (absListView.getLastVisiblePosition() < absListView.getChildCount() - 1
                    || absListView.getChildAt(absListView.getChildCount() - 1).getBottom() > absListView.getPaddingBottom());
        } else {
            return targetView.getScrollY() < 0;
        }
    } else {
        return targetView.canScrollVertically(1);
    }
}
 
开发者ID:scwang90,项目名称:SmartRefreshLayout,代码行数:15,代码来源:ScrollBoundaryUtil.java

示例14: 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;
            return absListView.getChildCount() > 0
                    && absListView.getLastVisiblePosition() == absListView.getAdapter().getCount() - 1;
        } else {
            return mTarget.getScrollY() < 0;
        }
    } else {
        return ViewCompat.canScrollVertically(mTarget, 1);
    }
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:14,代码来源:LingjuSwipeRefreshLayout.java

示例15: canScrollUp

import android.widget.AbsListView; //导入方法依赖的package包/类
private boolean canScrollUp(View view) {
    if (android.os.Build.VERSION.SDK_INT < 14) {
        if (view instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) view;
            return absListView.getChildCount() > 0
                    && (absListView.getFirstVisiblePosition() > 0 || absListView.getChildAt(0)
                    .getTop() < absListView.getPaddingTop());
        } else {
            return ViewCompat.canScrollVertically(view, -1) || view.getScrollY() > 0;
        }
    } else {
        return ViewCompat.canScrollVertically(view, -1);
    }
}
 
开发者ID:rawray,项目名称:RRFramework-Android,代码行数:15,代码来源:RefreshLayout.java


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