android.view.ContextMenu.setHeaderView()方法的使用及代码示例

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

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

ContextMenu.setHeaderView介绍

暂无

代码示例

代码示例来源:origin: andstatus/andstatus

public ContextMenuHeader(Context context, ContextMenu contextMenu) {
  header = View.inflate(context, R.layout.context_menu_header, null);
  contextMenu.setHeaderView(header);
}

代码示例来源:origin: derry/delion

private void setHeaderText(Context context, ContextMenu menu, String text) {
    ContextMenuTitleView title = new ContextMenuTitleView(context, text);
    menu.setHeaderView(title);
  }
}

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

@Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    //TODO ask touchlistener for swipe action
    menu.setHeaderView(Helper.getMenuHeader(contextActivity, contextActivity.getString(R.string.select_option)));
    MenuInflater inflater = contextActivity.getMenuInflater();
    inflater.inflate(R.menu.todo_list_long_click, menu);
  }
}

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

public void onCreateContextMenu(ContextMenu menu, View v,
                ContextMenu.ContextMenuInfo menuInfo) {
  ExpandableListView.ExpandableListContextMenuInfo info =
      (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;
  int type = ExpandableListView.getPackedPositionType(info.packedPosition);
  MenuInflater inflater = this.getMenuInflater();
  menu.setHeaderView(Helper.getMenuHeader(getBaseContext(), getBaseContext().getString(R.string.select_option)));
  // context menu for child items
  if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
    inflater.inflate(R.menu.todo_subtask_long_click, menu);
  } else { // context menu for group items
    inflater.inflate(R.menu.todo_task_long_click, menu);
  }
}

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

@Override
public void onCreateContextMenu(ContextMenu menu, View v,
                ContextMenu.ContextMenuInfo menuInfo) {
  ExpandableListView.ExpandableListContextMenuInfo info =
      (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;
  int type = ExpandableListView.getPackedPositionType(info.packedPosition);
  MenuInflater inflater = getActivity().getMenuInflater();
  menu.setHeaderView(Helper.getMenuHeader(getContext(), getContext().getString(R.string.select_option)));
  // context menu for child items
  if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
    inflater.inflate(R.menu.todo_subtask_long_click, menu);
  } else { // context menu for group items
    inflater.inflate(R.menu.todo_task_long_click, menu);
  }
}

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

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
  super.onCreateContextMenu(menu, v, menuInfo);
  ExpandableListView.ExpandableListContextMenuInfo info =
      (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;
  int type = ExpandableListView.getPackedPositionType(info.packedPosition);
  MenuInflater inflater = this.getMenuInflater();
  menu.setHeaderView(Helper.getMenuHeader(getBaseContext(), getBaseContext().getString(R.string.select_option)));
  inflater.inflate(R.menu.deleted_task_long_click, menu);
}

相关文章