android.widget.GridView.setItemChecked()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(178)

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

GridView.setItemChecked介绍

暂无

代码示例

代码示例来源:origin: AlexMofer/ProjectX

@Override
public void setItemChecked(int position, boolean value) {
  super.setItemChecked(
      position + (mAdapter == null ? 0 : mAdapter.getHeaderViewsCount()), value);
}

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

final GridView filters = (GridView) child.findViewById(R.id.filter_gridview);
final WeedFilterGridViewAdapter adapter = new WeedFilterGridViewAdapter(this, values);
filters.setAdapter(adapter);
filters.setSelection(0);
// add this line
filters.setItemChecked(0, true);

代码示例来源:origin: qq8585083/DragIcon

@Override
public void setItemChecked(int position, boolean value) {
  super.setItemChecked(
      position + (mAdapter == null ? 0 : mAdapter.getHeaderViewsCount()), value);
}

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

mDrawerList.setItemChecked(0, true); // NOTE: Set 0 item as checked!
mDrawerList.setOnItemClickListener(new SlideMenuClickListener());
  displayView(position);
  mDrawerList.setItemChecked(position, true);

代码示例来源:origin: googlecodelabs/android-topeka

private void setUpGridView(View container) {
  mAvatarGrid = (GridView) container.findViewById(R.id.avatars);
  mAvatarGrid.setAdapter(new AvatarAdapter(getActivity()));
  mAvatarGrid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
      mSelectedAvatarView = view;
      mSelectedAvatar = Avatar.values()[position];
      // showing the floating action button if input data is valid
      if (isInputDataValid()) {
        mDoneFab.show();
      }
    }
  });
  mAvatarGrid.setNumColumns(calculateSpanCount());
  if (mSelectedAvatar != null) {
    mAvatarGrid.setItemChecked(mSelectedAvatar.ordinal(), true);
  }
}

代码示例来源:origin: xbmc/Kore

adapter = new HostListAdapter(context, R.layout.grid_item_host, hostInfoRows);
hostGridView.setAdapter(adapter);
hostGridView.setItemChecked(currentHostPosition, true);
hostGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  @Override

代码示例来源:origin: SimonMarquis/Android-PreferencesManager

@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
  switch (item.getItemId()) {
    case R.id.action_delete:
      ((PreferenceAdapter) gridView.getAdapter()).deleteSelection();
      Utils.savePreferences(preferenceFile, mFile, mPackageName, getActivity());
      ((PreferenceAdapter) gridView.getAdapter()).notifyDataSetChanged();
      mode.finish();
      return true;
    case R.id.action_select_all:
      boolean check = gridView.getCheckedItemCount() != gridView.getCount();
      for (int i = 0; i < gridView.getCount(); i++) {
        gridView.setItemChecked(i, check);
      }
      return true;
    default:
      return false;
  }
}

相关文章

GridView类方法