android.widget.SeekBar.onKeyDown()方法的使用及代码示例

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

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

SeekBar.onKeyDown介绍

暂无

代码示例

代码示例来源:origin: osfans/trime

public boolean onKey(View v, int keyCode, KeyEvent event) {
 if (event.getAction() != KeyEvent.ACTION_DOWN) {
  return false;
 }
 SeekBar seekBar = (SeekBar) v.findViewById(R.id.seekbar);
 if (seekBar == null) {
  return false;
 }
 return seekBar.onKeyDown(keyCode, event);
}

代码示例来源:origin: consp1racy/android-support-preference

@Override
  public boolean onKey(@NonNull View v, int keyCode, @NonNull KeyEvent event) {
    if (event.getAction() != KeyEvent.ACTION_DOWN) {
      return false;
    }
    if (!mAdjustable && (keyCode == KeyEvent.KEYCODE_DPAD_LEFT
        || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT)) {
      // Right or left keys are pressed when in non-adjustable mode; Skip the keys.
      return false;
    }
    // We don't want to propagate the click keys down to the seekbar view since it will
    // create the ripple effect for the thumb.
    if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER || keyCode == KeyEvent.KEYCODE_ENTER) {
      return false;
    }
    if (seekBar == null) {
      Log.e(TAG, "SeekBar view is null and hence cannot be adjusted.");
      return false;
    }
    return seekBar.onKeyDown(keyCode, event);
  }
};

相关文章

SeekBar类方法