本文整理汇总了Java中android.widget.AdapterView.getFirstVisiblePosition方法的典型用法代码示例。如果您正苦于以下问题:Java AdapterView.getFirstVisiblePosition方法的具体用法?Java AdapterView.getFirstVisiblePosition怎么用?Java AdapterView.getFirstVisiblePosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.AdapterView
的用法示例。
在下文中一共展示了AdapterView.getFirstVisiblePosition方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canAdapterViewScroll
import android.widget.AdapterView; //导入方法依赖的package包/类
private static boolean canAdapterViewScroll(AdapterView lv) {
/* Force it to layout it's children */
if (lv.getLastVisiblePosition() == -1)
return false;
/* We can scroll if the first or last item is not visible */
boolean firstItemVisible = lv.getFirstVisiblePosition() == 0;
boolean lastItemVisible = lv.getLastVisiblePosition() == lv.getCount() - 1;
if (firstItemVisible && lastItemVisible && lv.getChildCount() > 0) {
/* Or the first item's top is above or own top */
if (lv.getChildAt(0).getTop() < lv.getPaddingTop())
return true;
/* or the last item's bottom is beyond our own bottom */
return lv.getChildAt(lv.getChildCount() - 1).getBottom() >
lv.getHeight() - lv.getPaddingBottom();
}
return true;
}
示例2: onItemClick
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> adapter, View view, int pos, long id) {
// Log.d("log:", String.format("pos:%d", pos));
// make sure we're clicking a cell, do not send callbacks for header or footer rows.
ATableView tableView = (ATableView) view.getParent();
ATableViewDelegate delegate = mTableView.getDelegate();
if (view instanceof ATableViewCell) {
// don't throw up selection events if it's not allowed by the table configuration.
if (tableView.getAllowsSelection()) {
NSIndexPath ip = mTableView.getInternalAdapter().getIndexPath(pos);
delegate.didSelectRowAtIndexPath(mTableView, ip);
delegate.postDidSelectCell(mTableView, (ATableViewCell) view, ip);
}
} else {
if (mTableView.needPinnedHeader() && adapter.getFirstVisiblePosition() == pos && mTableView.mHeaderView.getVisibility() != View.GONE) {
return;
}
delegate.clickHeaderForSection(mTableView, view, mTableView.getInternalAdapter().getSection(pos));
}
}
示例3: startAnimation
import android.widget.AdapterView; //导入方法依赖的package包/类
void startAnimation(int type, AdapterView<?> parent, int position, int visibleCount) {
int offset = parent.getFirstVisiblePosition();
int start = position - offset + 1;
int end = (start + visibleCount) <= parent.getChildCount() ? (start + visibleCount - 1) : parent.getChildCount();
for (int i = start; i <= end; i++) {
addAnimation(type, parent, i);
}
}
示例4: avPullDownIntercept
import android.widget.AdapterView; //导入方法依赖的package包/类
public boolean avPullDownIntercept(View child) {
boolean intercept = true;
AdapterView adapterChild = (AdapterView) child;
// 判断AbsListView是否已经到达内容最顶部
if (adapterChild.getFirstVisiblePosition() != 0
|| adapterChild.getChildAt(0).getTop() != 0) {
// 如果没有达到最顶端,则仍然将事件下放
intercept = false;
}
return intercept;
}