android.widget.ExpandableListView.setOnItemLongClickListener()方法的使用及代码示例

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

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

ExpandableListView.setOnItemLongClickListener介绍

暂无

代码示例

代码示例来源:origin: SecUSo/privacy-friendly-netmonitor

expListView.setOnItemLongClickListener(new ExpandableListView.OnItemLongClickListener() {
  @Override
  public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {

代码示例来源:origin: gigabytedevelopers/FireFiles

@Override
public void onResume() {
  super.onResume();
  final Context context = getActivity();
  final State state = ((BaseActivity) context).getDisplayState();
  state.showAdvanced = state.forceAdvanced
      | SettingsActivity.getDisplayAdvancedDevices(context);
  state.rootMode = SettingsActivity.getRootMode(getActivity());
  
  if (state.action == ACTION_BROWSE) {
    mList.setOnItemLongClickListener(mItemLongClickListener);
  } else {
    mList.setOnItemLongClickListener(null);
    mList.setLongClickable(false);
  }
  getLoaderManager().restartLoader(2, null, mCallbacks);
}

代码示例来源:origin: SecUSo/privacy-friendly-todo-list

TextView emptyView = (TextView) v.findViewById(R.id.tv_empty_view_no_tasks);
expandableListView = (ExpandableListView) v.findViewById(R.id.exlv_tasks);
expandableListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {

代码示例来源:origin: SecUSo/privacy-friendly-todo-list

public void updateAdapter() {
  dbhelper = DatabaseHelper.getInstance(this);
  ArrayList<TodoTask> tasks;
  tasks = DBQueryHandler.getBin(dbhelper.getReadableDatabase());
  expandableTodoTaskAdapter = new ExpandableTodoTaskAdapter(this, tasks);
  lv.setAdapter(expandableTodoTaskAdapter);
  lv.setEmptyView(tv);
  lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
    @Override
    public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
      int groupPosition = ExpandableListView.getPackedPositionGroup(id);
      if (ExpandableListView.getPackedPositionType(id) == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
        int childPosition = ExpandableListView.getPackedPositionChild(id);
        expandableTodoTaskAdapter.setLongClickedSubTaskByPos(groupPosition, childPosition);
      } else {
        expandableTodoTaskAdapter.setLongClickedTaskByPos(groupPosition);
      }
      registerForContextMenu(lv);
      return false;
    }
  });
}

代码示例来源:origin: SecUSo/privacy-friendly-todo-list

private void showAllTasks() {
  dbHelper = DatabaseHelper.getInstance(this);
  ArrayList<TodoTask> tasks;
  tasks = DBQueryHandler.getAllToDoTasks(dbHelper.getReadableDatabase());
  expandableTodoTaskAdapter = new ExpandableTodoTaskAdapter(this, tasks);
  exLv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
    @Override
    public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
      int groupPosition = ExpandableListView.getPackedPositionGroup(id);
      if (ExpandableListView.getPackedPositionType(id) == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
        int childPosition = ExpandableListView.getPackedPositionChild(id);
        expandableTodoTaskAdapter.setLongClickedSubTaskByPos(groupPosition, childPosition);
      } else {
        expandableTodoTaskAdapter.setLongClickedTaskByPos(groupPosition);
      }
      registerForContextMenu(exLv);
      return false;
    }
  });
  exLv.setAdapter(expandableTodoTaskAdapter);
  exLv.setEmptyView(tv);
  optionFab.setVisibility(View.VISIBLE);
  initFab(true, 0, false);
  hints();
}

相关文章

ExpandableListView类方法