android.widget.ImageButton.setPressed()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(182)

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

ImageButton.setPressed介绍

暂无

代码示例

代码示例来源:origin: vocollapse/Blockinger

@Override
  public boolean onTouch(View v, MotionEvent event) {
    if(event.getAction() == MotionEvent.ACTION_DOWN) {
      controls.rotateRightPressed();
      ((ImageButton)findViewById(R.id.rotateRightButton)).setPressed(true);
    } else if (event.getAction() == MotionEvent.ACTION_UP) {
      controls.rotateRightReleased();
      ((ImageButton)findViewById(R.id.rotateRightButton)).setPressed(false);
    }
    return true;
  }
});

代码示例来源:origin: vocollapse/Blockinger

@Override
  public boolean onTouch(View v, MotionEvent event) {
    if(event.getAction() == MotionEvent.ACTION_DOWN) {
      controls.dropButtonPressed();
      ((ImageButton)findViewById(R.id.hardDropButton)).setPressed(true);
    } else if (event.getAction() == MotionEvent.ACTION_UP) {
      controls.dropButtonReleased();
      ((ImageButton)findViewById(R.id.hardDropButton)).setPressed(false);
    }
    return true;
  }
});

代码示例来源:origin: vocollapse/Blockinger

@Override
  public boolean onTouch(View v, MotionEvent event) {
    if(event.getAction() == MotionEvent.ACTION_DOWN) {
      controls.rotateLeftPressed();
      ((ImageButton)findViewById(R.id.rotateLeftButton)).setPressed(true);
    } else if (event.getAction() == MotionEvent.ACTION_UP) {
      controls.rotateLeftReleased();
      ((ImageButton)findViewById(R.id.rotateLeftButton)).setPressed(false);
    }
    return true;
  }
});

代码示例来源:origin: vocollapse/Blockinger

@Override
  public boolean onTouch(View v, MotionEvent event) {
    if(event.getAction() == MotionEvent.ACTION_DOWN) {
      controls.rightButtonPressed();
      ((ImageButton)findViewById(R.id.rightButton)).setPressed(true);
    } else if (event.getAction() == MotionEvent.ACTION_UP) {
      controls.rightButtonReleased();
      ((ImageButton)findViewById(R.id.rightButton)).setPressed(false);
    }
    return true;
  }
});

代码示例来源:origin: vocollapse/Blockinger

@Override
  public boolean onTouch(View v, MotionEvent event) {
    if(event.getAction() == MotionEvent.ACTION_DOWN) {
      controls.leftButtonPressed();
      ((ImageButton)findViewById(R.id.leftButton)).setPressed(true);
    } else if (event.getAction() == MotionEvent.ACTION_UP) {
      controls.leftButtonReleased();
      ((ImageButton)findViewById(R.id.leftButton)).setPressed(false);
    }
    return true;
  }
});

代码示例来源:origin: vocollapse/Blockinger

@Override
  public boolean onTouch(View v, MotionEvent event) {
    if(event.getAction() == MotionEvent.ACTION_DOWN) {
      controls.downButtonPressed();
      ((ImageButton)findViewById(R.id.softDropButton)).setPressed(true);
    } else if (event.getAction() == MotionEvent.ACTION_UP) {
      controls.downButtonReleased();
      ((ImageButton)findViewById(R.id.softDropButton)).setPressed(false);
    }
    return true;
  }
});

代码示例来源:origin: henrichg/PhoneProfilesPlus

@Override
public boolean onLongClick(View v) {
  v.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
  if (v == mDelete) {
    mDelete.setPressed(false);
    reset();
    updateKeypad();
    return true;
  }
  return false;
}

代码示例来源:origin: com.albedinsky.android/ui-widget-image

/**
 */
@Override
public void setPressed(boolean pressed) {
  final boolean isPressed = isPressed();
  super.setPressed(pressed);
  if (!isPressed && pressed) onPressed();
  else if (isPressed) onReleased();
}

代码示例来源:origin: com.albedinsky.android/ui-widget-common

/**
 */
@Override
public void setPressed(boolean pressed) {
  final boolean isPressed = isPressed();
  super.setPressed(pressed);
  if (!isPressed && pressed) onPressed();
  else if (isPressed) onReleased();
}

代码示例来源:origin: henrichg/PhoneProfilesPlus

@Override
public boolean onLongClick(View v) {
  v.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
  if (v == mDelete) {
    mDelete.setPressed(false);
    reset();
    updateKeypad();
    return true;
  }
  return false;
}

代码示例来源:origin: henrichg/PhoneProfilesPlus

@Override
public boolean onLongClick(View v) {
  v.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
  if (v == mDelete) {
    mDelete.setPressed(false);
    mAmPmState = AMPM_NOT_SELECTED;
    reset();
    updateKeypad();
    return true;
  }
  return false;
}

代码示例来源:origin: com.albedinsky.android/ui

/**
 */
@Override
public void setPressed(boolean pressed) {
  final boolean isPressed = isPressed();
  super.setPressed(pressed);
  if (!isPressed && pressed) onPressed();
  else if (isPressed) onReleased();
}

代码示例来源:origin: henrichg/PhoneProfilesPlus

@Override
public boolean onLongClick(View v) {
  v.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
  if (v == mDelete) {
    mDelete.setPressed(false);
    reset();
    updateKeypad();
    return true;
  }
  return false;
}

代码示例来源:origin: henrichg/PhoneProfilesPlus

@Override
public boolean onLongClick(View v) {
  v.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
  mError.hideImmediately();
  if (v == mDelete) {
    mDelete.setPressed(false);
    reset();
    updateKeypad();
    return true;
  }
  return false;
}

相关文章

ImageButton类方法