本文整理了Java中android.widget.Adapter.getItemId()
方法的一些代码示例,展示了Adapter.getItemId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Adapter.getItemId()
方法的具体详情如下:
包路径:android.widget.Adapter
类名称:Adapter
方法名:getItemId
暂无
代码示例来源:origin: chentao0707/SimplifyReader
public long getItemIdAtPosition(int position) {
T adapter = getAdapter();
return (adapter == null || position < 0) ? INVALID_ROW_ID : adapter.getItemId(position);
}
代码示例来源:origin: chentao0707/SimplifyReader
rowId = adapter.getItemId(seed);
if (rowId == idToMatch) {
代码示例来源:origin: balysv/material-ripple
private void clickAdapterView(AdapterView parent) {
final int position = parent.getPositionForView(MaterialRippleLayout.this);
final long itemId = parent.getAdapter() != null
? parent.getAdapter().getItemId(position)
: 0;
if (position != AdapterView.INVALID_POSITION) {
parent.performItemClick(MaterialRippleLayout.this, position, itemId);
}
}
}
代码示例来源:origin: chentao0707/SimplifyReader
/**
* Remember enough information to restore the screen state when the data has
* changed.
*
*/
void rememberSyncState() {
if (getChildCount() > 0) {
mNeedSync = true;
mSyncHeight = mLayoutHeight;
// Sync the based on the offset of the first view
View v = getChildAt(0);
T adapter = getAdapter();
if (mFirstPosition >= 0 && mFirstPosition < adapter.getCount()) {
mSyncRowId = adapter.getItemId(mFirstPosition);
} else {
mSyncRowId = NO_ID;
}
mSyncPosition = mFirstPosition;
if (v != null) {
mSpecificTop = v.getTop();
}
mSyncMode = SYNC_FIRST_POSITION;
}
}
}
代码示例来源:origin: chentao0707/SimplifyReader
private void fireOnSelected() {
if (mOnItemSelectedListener == null) {
return;
}
final int selection = getSelectedItemPosition();
if (selection >= 0) {
View v = getSelectedView();
mOnItemSelectedListener.onItemSelected(this, v, selection,
getAdapter().getItemId(selection));
} else {
mOnItemSelectedListener.onNothingSelected(this);
}
}
代码示例来源:origin: daimajia/AndroidSwipeLayout
private void performAdapterViewItemClick() {
if (getOpenStatus() != Status.Close) return;
ViewParent t = getParent();
if (t instanceof AdapterView) {
AdapterView view = (AdapterView) t;
int p = view.getPositionForView(SwipeLayout.this);
if (p != AdapterView.INVALID_POSITION) {
view.performItemClick(view.getChildAt(p - view.getFirstVisiblePosition()), p, view
.getAdapter().getItemId(p));
}
}
}
代码示例来源:origin: jiang111/IndexRecyclerView
private void performAdapterViewItemClick() {
ViewParent t = getParent();
if (t instanceof AdapterView) {
AdapterView view = (AdapterView) t;
int p = view.getPositionForView(SwipeItemLayout.this);
if (p != AdapterView.INVALID_POSITION) {
view.performItemClick(view.getChildAt(p - view.getFirstVisiblePosition()), p, view.getAdapter().getItemId(p));
}
}
}
代码示例来源:origin: stackoverflow.com
static final int getAdapterPositionById(final Adapter adapter, final long id) throws NoSuchElementException {
final int count = adapter.getCount();
for (int pos = 0; pos < count; pos++) {
if (id == adapter.getItemId(pos)) {
return pos;
}
}
throw new NoSuchElementException();
}
代码示例来源:origin: quaap/LaunchTime
@Override
public void onClick(View view) {
onItemClick(staticListView.mAdapter.getItem(pos), itemView, pos, staticListView.mAdapter.getItemId(pos));
}
});
代码示例来源:origin: com.github.japgolly.android.test/robolectric
@Implementation
public long getItemIdAtPosition(int position) {
Adapter adapter = getAdapter();
return (adapter == null || position < 0) ? AdapterView.INVALID_ROW_ID : adapter.getItemId(position);
}
代码示例来源:origin: com.github.japgolly.android.test/robolectric
@Override
public void run() {
if (hasOnItemSelectedListener()) {
onItemSelectedListener.onItemSelected(realAdapterView, getChildAt(position), position, getAdapter().getItemId(position));
}
}
});
代码示例来源:origin: jjhesk/KickAssSlidingMenu
private void clickAdapterView(AdapterView parent) {
final int position = parent.getPositionForView(MaterialRippleLayout.this);
final long itemId = parent.getAdapter() != null
? parent.getAdapter().getItemId(position)
: 0;
if (position != AdapterView.INVALID_POSITION) {
parent.performItemClick(MaterialRippleLayout.this, position, itemId);
}
}
}
代码示例来源:origin: darkskygit/VirtualApp
private void clickAdapterView(AdapterView parent) {
final int position = parent.getPositionForView(MaterialRippleLayout.this);
final long itemId = parent.getAdapter() != null
? parent.getAdapter().getItemId(position)
: 0;
if (position != AdapterView.INVALID_POSITION) {
parent.performItemClick(MaterialRippleLayout.this, position, itemId);
}
}
}
代码示例来源:origin: jjhesk/KickAssSlidingMenu
private void clickAdapterView(AdapterView parent) {
final int position = parent.getPositionForView(MaterialRippleLayoutNineOld.this);
final long itemId = parent.getAdapter() != null
? parent.getAdapter().getItemId(position)
: 0;
if (position != AdapterView.INVALID_POSITION) {
parent.performItemClick(MaterialRippleLayoutNineOld.this, position, itemId);
}
}
}
代码示例来源:origin: bzsome/VirtualApp-x326
private void clickAdapterView(AdapterView parent) {
final int position = parent.getPositionForView(MaterialRippleLayout.this);
final long itemId = parent.getAdapter() != null
? parent.getAdapter().getItemId(position)
: 0;
if (position != AdapterView.INVALID_POSITION) {
parent.performItemClick(MaterialRippleLayout.this, position, itemId);
}
}
}
代码示例来源:origin: com.actionbarsherlock/actionbarsherlock
private void fireOnSelected() {
if (mOnItemSelectedListener == null)
return;
int selection = this.getSelectedItemPosition();
if (selection >= 0) {
View v = getSelectedView();
mOnItemSelectedListener.onItemSelected(this, v, selection,
getAdapter().getItemId(selection));
} else {
mOnItemSelectedListener.onNothingSelected(this);
}
}
代码示例来源:origin: dalong982242260/CarrouselView
private void fireOnSelected() {
if (mOnItemSelectedListener == null)
return;
int selection = this.getSelectedItemPosition();
if (selection >= 0) {
View v = getSelectedView();
mOnItemSelectedListener.onItemSelected(this, v, selection,
getAdapter().getItemId(selection));
} else {
mOnItemSelectedListener.onNothingSelected(this);
}
}
代码示例来源:origin: com.willowtreeapps/oak-demos
private void fireOnSelected() {
if (mOnItemSelectedListener == null)
return;
int selection = this.getSelectedItemPosition();
if (selection >= 0) {
View v = getSelectedView();
mOnItemSelectedListener.onItemSelected(this, v, selection,
getAdapter().getItemId(selection));
} else {
mOnItemSelectedListener.onNothingSelected(this);
}
}
代码示例来源:origin: wuzhendev/samples
private void fireOnSelected() {
if (mOnItemSelectedListener == null)
return;
int selection = this.getSelectedItemPosition();
if (selection >= 0) {
View v = getSelectedView();
mOnItemSelectedListener.onItemSelected(this, v, selection, getAdapter().getItemId(selection));
} else {
mOnItemSelectedListener.onNothingSelected(this);
}
}
代码示例来源:origin: bingoogolapple/BGASwipeItemLayout-Android
private void performAdapterViewItemClick() {
ViewParent t = getParent();
if (t instanceof AdapterView) {
AdapterView view = (AdapterView) t;
int p = view.getPositionForView(BGASwipeItemLayout.this);
if (p != AdapterView.INVALID_POSITION) {
view.performItemClick(view.getChildAt(p - view.getFirstVisiblePosition()), p, view.getAdapter().getItemId(p));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!