android.widget.ListView.getItemIdAtPosition()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(160)

本文整理了Java中android.widget.ListView.getItemIdAtPosition()方法的一些代码示例,展示了ListView.getItemIdAtPosition()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListView.getItemIdAtPosition()方法的具体详情如下:
包路径:android.widget.ListView
类名称:ListView
方法名:getItemIdAtPosition

ListView.getItemIdAtPosition介绍

暂无

代码示例

代码示例来源:origin: andkulikov/Transitions-Everywhere

if (listview.getAdapter().hasStableIds()) {
  int position = listview.getPositionForView(view);
  long itemId = listview.getItemIdAtPosition(position);
  if (transitionValuesMaps.itemIdValues.indexOfKey(itemId) >= 0) {

代码示例来源:origin: stackoverflow.com

ListView lv = (ListView)findViewById(R.id.MyListView);

lv.setOnItemClickListener(new OnItemClickListener() {

      @Override
      public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
          long arg3) {

        i = new Intent(ProductActivity.this, ProductDetails.class);

        i.putExtra("keyAapo", (int) lv.getItemIdAtPosition(arg2));

        startActivity(i);

      }

    });

代码示例来源:origin: stackoverflow.com

ListView lv = (ListView) findViewById(R.id.listView_ProductList);
lv.setOnItemClickListener(new OnItemClickListener() {

      @Override
      public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
          long arg3) {

        i = new Intent(ProductActivity.this, ProductDetails.class);
        // i.putExtra("keyAapo", arg2 );

        i.putExtra("keyAapo", (int) lv.getItemIdAtPosition(arg2));

        startActivity(i);

      }

    });

代码示例来源:origin: stackoverflow.com

ListView list = preferenceActivity.getListView();
list.performItemClick(list, 1, list.getItemIdAtPosition(1));

代码示例来源:origin: stackoverflow.com

long position = masterlist.getItemIdAtPosition(i);
if (position == 0) {
  itemClickResponse.itemClick(position);

代码示例来源:origin: stackoverflow.com

public void onListViewItemClick(){
     Activity activity = getActivity();
     final ListView listView = (ListView)activity.findViewById(android.R.id.list);
     getInstrumentation().runOnMainSync(new Runnable() {
      @Override
      public void run() {
        listView.performItemClick(listView.getAdapter().getView(0, null, null), 0, listView.getItemIdAtPosition(0));
      }
    });
}

代码示例来源:origin: lessthanoptimal/BoofAndroidDemo

private void moveToSelected( String target ) {
  int matched = -1;
  for (int i = 0; i < qrcodes.size(); i++) {
    if( qrcodes.get(i).message.equals(target)) {
      matched = i;
      break;
    }
  }
  if( matched != -1 ) {
    listView.smoothScrollToPosition(matched);
    listView.performItemClick(listView.getChildAt(matched),matched,
        listView.getItemIdAtPosition(matched));
  }
}

代码示例来源:origin: GeoODK/collect

@Override
  public void onClick(View v) {
    // toggle selections of items to all or none
    ListView ls = getListView();
    mToggled = !mToggled;
    Collect.getInstance()
        .getActivityLogger()
        .logAction(this, "toggleButton",
            Boolean.toString(mToggled));
    // remove all items from selected list
    mSelected.clear();
    for (int pos = 0; pos < ls.getCount(); pos++) {
      ls.setItemChecked(pos, mToggled);
      // add all items if mToggled sets to select all
      if (mToggled)
        mSelected.add(ls.getItemIdAtPosition(pos));
    }
    mUploadButton.setEnabled(!(mSelected.size() == 0));
  }
});

代码示例来源:origin: vanilla-music/vanilla

if(shouldScroll) {
  for (int pos = 0; pos < view.getCount(); pos++) {
    if (view.getItemIdAtPosition(pos) == id) {

代码示例来源:origin: GeoODK/collect

for (long id : mSelected) {
  for (int pos = 0; pos < ls.getCount(); pos++) {
    if (id == ls.getItemIdAtPosition(pos)) {
      ls.setItemChecked(pos, true);
      break;

相关文章

ListView类方法