android.widget.Spinner.setOnTouchListener()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(183)

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

Spinner.setOnTouchListener介绍

暂无

代码示例

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

spinner.setOnTouchListener(new View.OnTouchListener() {
  @Override
  public boolean onTouch(View v, MotionEvent event) {

代码示例来源:origin: lordi/tickmate

private void initializeGroupSpinner() {
  mGroupSpinner.setOnTouchListener(this);
  List<Group> allGroups = DataSource.getInstance().getGroups();
  mGroupSpinner.setVisibility((allGroups.size() > 0) ? View.VISIBLE : View.GONE);
  List<String> mSpinnerArrayNames = new ArrayList<>();
  mSpinnerArrayNames.add(getResources().getString(R.string.group_all_name));
  for (Group group : allGroups) {
    mSpinnerArrayNames.add(group.getName());
  }
  initializeGroupIds();
  ArrayAdapter<String> spinnerArrayAdapter =
      new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_dropdown_item, mSpinnerArrayNames);
  mGroupSpinner.setAdapter(spinnerArrayAdapter);
  SharedPreferences groupPreferences = getContext().getSharedPreferences(TickmateConstants.GROUP_PREFS, Context.MODE_PRIVATE);
  mSpinnerPosition = groupPreferences.getInt(TickmateConstants.GROUP_SELECTED, 0);
  mGroupSpinner.setSelection(mSpinnerPosition);
  mGroupSpinner.setOnItemSelectedListener(this);
}

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

abstract class OnOpenListener implements OnTouchListener, OnItemSelectedListener {

  public OnOpenListener(Spinner spinner) {
    spinner.setOnTouchListener(this);
    spinner.setOnItemSelectedListener(this);
  }

  @Override
  public boolean onTouch(View v, MotionEvent event) {
    if (event.getAction() == MotionEvent.ACTION_UP) {
      onOpen();
    }
    return false;
  }

  @Override
  public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
    onClose();
  }

  @Override
  public void onNothingSelected(AdapterView<?> arg0) {
    onClose();
  }

  abstract public void onOpen();

  abstract public void onClose();
}

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

spinner.setOnTouchListener(new View.OnTouchListener() {

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

sp1.setOnTouchListener(new OnTouchListener() {
sp2.setOnTouchListener(new OnTouchListener() {
sp3.setOnTouchListener(new OnTouchListener() {

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

mSpinner.setOnTouchListener(mSpinnerTouchListener);
mSpinner.setAdapter(mCursorAdapter);

相关文章