本文整理匯總了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;
}