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


Java AbsListView.getCount方法代码示例

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


在下文中一共展示了AbsListView.getCount方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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包/类
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: 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;
            try {
                if (absListView.getCount() > 0) {
                    if (absListView.getLastVisiblePosition() + 1 == absListView.getCount()) {
                        int lastIndex = absListView.getLastVisiblePosition() - absListView.getFirstVisiblePosition();
                        return absListView.getChildAt(lastIndex).getBottom() == absListView.getPaddingBottom();
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return true;
        } else {
            return true;
        }
    } else {
        return ViewCompat.canScrollVertically(mTarget, 1);
    }
}
 
开发者ID:HanyeeWang,项目名称:GeekZone,代码行数:23,代码来源:SwipeRefreshLayout.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: onScroll

import android.widget.AbsListView; //导入方法依赖的package包/类
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
		int visibleItemCount, int totalItemCount) {
	mFirstVisibleItem = firstVisibleItem;
	if (view.getFirstVisiblePosition() == 1) {
		mIsTop = true;
	} else if (view.getLastVisiblePosition() == view.getCount() - 1) {
		mIsBottom = true;
	} else {
		mIsTop = false;
		mIsBottom = false;
	}
}
 
开发者ID:qizhenghao,项目名称:HiBangClient,代码行数:14,代码来源:HandyListView.java

示例6: isReadyForPull

import android.widget.AbsListView; //导入方法依赖的package包/类
public boolean isReadyForPull(View view, float x, float y) {
    AbsListView absListView = (AbsListView) view;
    if (absListView.getCount() == 0) {
        return true;
    }
    if (absListView.getFirstVisiblePosition() != 0) {
        return false;
    }
    View firstVisibleChild = absListView.getChildAt(0);
    boolean ready = firstVisibleChild != null && firstVisibleChild.getTop() >= absListView
            .getPaddingTop();
    return ready;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:14,代码来源:AbsListViewDelegate.java

示例7: refresh

import android.widget.AbsListView; //导入方法依赖的package包/类
/**
 * Check if some thumbnails are needed.
 * To be called to restart the Thumbnail engine after is has been stopped, for some reason.
 * ('listView' has to be given by the caller because ThumbnailRequester doesn't know it (it only gets callbacks from it))
 */
public void refresh(AbsListView listView) {
	// First be sure that onScrollStateChanged() won't think it has not moved, hence need no request
	reset();
	// Sanity check
	if (listView.getCount()<1) {
		return;
	}
	// Simulate an onScroll call
	onScroll( listView, listView.getFirstVisiblePosition(),
			listView.getLastVisiblePosition()-listView.getFirstVisiblePosition(),
			listView.getCount());
}
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:18,代码来源:ThumbnailRequester.java

示例8: restoreBestPositionWithScroll

import android.widget.AbsListView; //导入方法依赖的package包/类
/**
  * Restore the best position possible in the list.
  *
  * @return the new last position
  */
 public static int restoreBestPositionWithScroll(final AbsListView listView, int selectedPosition,
         int firstVisiblePosition,  final int scroll) {
 	if(listView.getFirstVisiblePosition() <= selectedPosition && listView.getLastVisiblePosition()>=selectedPosition)
 		return selectedPosition;
     final int newPositionToSelect;
     newPositionToSelect = selectedPosition>=0?selectedPosition:0;
     if (newPositionToSelect < listView.getCount()) {
         //we select next enabled view
         for(int i = newPositionToSelect; i<listView.getCount(); i++){      
             if(i<listView.getAdapter().getCount()&&listView.getAdapter().isEnabled(i)){
                  //we don't want to loose scroll
                     final int pos = i;  
                     if(listView instanceof GridView){
                     	listView.setSelection(pos);
                         listView.smoothScrollToPositionFromTop(pos, scroll);
                     }
                     else if(listView instanceof ListView)
                         ((ListView)listView).setSelectionFromTop(pos, scroll);
                   
             
                 break;       
             }     
         }
         
         // Make sure the album list/grid has still the focus after changing the
         // view mode
         listView.postDelayed(new Runnable() {
	@Override
	public void run() {
		listView.requestFocus();		
	}
}, 200);
     }
     return newPositionToSelect;
 }
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:41,代码来源:Utils.java


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