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

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

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

ImageButton.requestFocus介绍

暂无

代码示例

代码示例来源:origin: pili-engineering/PLDroidPlayer

mPauseButton.requestFocus();
mPauseButton.setOnClickListener(mPauseListener);

代码示例来源:origin: HotBitmapGG/bilibili-android-client

mTvPlay = (ImageView) v.findViewById(R.id.media_controller_tv_play);
if (mPauseButton != null && mTvPlay != null) {
  mPauseButton.requestFocus();
  mPauseButton.setOnClickListener(mPauseListener);
  mTvPlay.requestFocus();

代码示例来源:origin: HotBitmapGG/bilibili-android-client

mPauseButton.requestFocus();
mTvPlay.requestFocus();

代码示例来源:origin: pili-engineering/PLDroidPlayer

mPauseButton.requestFocus();
disableUnsupportedButtons();

代码示例来源:origin: pili-engineering/PLDroidPlayer

@Override
public boolean dispatchKeyEvent(KeyEvent event) {
  int keyCode = event.getKeyCode();
  if (event.getRepeatCount() == 0
      && (keyCode == KeyEvent.KEYCODE_HEADSETHOOK
      || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE || keyCode == KeyEvent.KEYCODE_SPACE)) {
    doPauseResume();
    show(sDefaultTimeout);
    if (mPauseButton != null)
      mPauseButton.requestFocus();
    return true;
  } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP) {
    if (mPlayer.isPlaying()) {
      mPlayer.pause();
      updatePausePlay();
    }
    return true;
  } else if (keyCode == KeyEvent.KEYCODE_BACK
      || keyCode == KeyEvent.KEYCODE_MENU) {
    hide();
    return true;
  } else {
    show(sDefaultTimeout);
  }
  return super.dispatchKeyEvent(event);
}

代码示例来源:origin: HotBitmapGG/bilibili-android-client

@Override
public boolean dispatchKeyEvent(KeyEvent event) {
  int keyCode = event.getKeyCode();
  if (event.getRepeatCount() == 0
      && (keyCode == KeyEvent.KEYCODE_HEADSETHOOK
      || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE || keyCode == KeyEvent.KEYCODE_SPACE)) {
    doPauseResume();
    show(sDefaultTimeout);
    if (mPauseButton != null && mTvPlay != null) {
      mPauseButton.requestFocus();
      mTvPlay.requestFocus();
    }
    return true;
  } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP) {
    if (mPlayer.isPlaying()) {
      mPlayer.pause();
      updatePausePlay();
    }
    return true;
  } else if (keyCode == KeyEvent.KEYCODE_BACK
      || keyCode == KeyEvent.KEYCODE_MENU) {
    hide();
    return true;
  } else {
    show(sDefaultTimeout);
  }
  return super.dispatchKeyEvent(event);
}

代码示例来源:origin: brianwernick/ExoMedia

@Override
protected void onAttachedToWindow() {
  super.onAttachedToWindow();
  playPauseButton.requestFocus();
  currentFocus = playPauseButton;
}

代码示例来源:origin: curtis2/SuperVideoPlayer

private void initControllerView(View v) {
  mPauseButton = (ImageButton) v.findViewById(getResources().getIdentifier("mediacontroller_play_pause", "id", mContext.getPackageName()));
  if (mPauseButton != null) {
    mPauseButton.requestFocus();
    mPauseButton.setOnClickListener(mPauseListener);
  }
  mProgress = (SeekBar) v.findViewById(getResources().getIdentifier("mediacontroller_seekbar", "id", mContext.getPackageName()));
  if (mProgress != null) {
    if (mProgress instanceof SeekBar) {
      SeekBar seeker = (SeekBar) mProgress;
      seeker.setOnSeekBarChangeListener(mSeekListener);
    }
    mProgress.setMax(1000);
  }
  mEndTime = (TextView) v.findViewById(getResources().getIdentifier("mediacontroller_time_total", "id", mContext.getPackageName()));
  mCurrentTime = (TextView) v.findViewById(getResources().getIdentifier("mediacontroller_time_current", "id", mContext.getPackageName()));
  mFileName = (TextView) v.findViewById(getResources().getIdentifier("mediacontroller_file_name", "id", mContext.getPackageName()));
  if (mFileName != null)
    mFileName.setText(mTitle);
}

代码示例来源:origin: pili-engineering/PLDroidShortVideo

mPauseButton.requestFocus();
mPauseButton.setOnClickListener(mPauseListener);

代码示例来源:origin: curtis2/SuperVideoPlayer

if (!mShowing && mAnchor != null && mAnchor.getWindowToken() != null) {
  if (mPauseButton != null)
    mPauseButton.requestFocus();

代码示例来源:origin: pili-engineering/PLDroidShortVideo

mPauseButton.requestFocus();
disableUnsupportedButtons();

代码示例来源:origin: curtis2/SuperVideoPlayer

@Override
public boolean dispatchKeyEvent(KeyEvent event) {
  int keyCode = event.getKeyCode();
  if (event.getRepeatCount() == 0 && (keyCode == KeyEvent.KEYCODE_HEADSETHOOK || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE || keyCode == KeyEvent.KEYCODE_SPACE)) {
    doPauseResume();
    show(sDefaultTimeout);
    if (mPauseButton != null)
      mPauseButton.requestFocus();
    return true;
  } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP) {
    if (mPlayer.isPlaying()) {
      mPlayer.pause();
      updatePausePlay();
    }
    return true;
  } else if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU) {
    hide();
    return true;
  } else {
    show(sDefaultTimeout);
  }
  return super.dispatchKeyEvent(event);
}

代码示例来源:origin: pili-engineering/PLDroidShortVideo

@Override
public boolean dispatchKeyEvent(KeyEvent event) {
  int keyCode = event.getKeyCode();
  if (event.getRepeatCount() == 0
      && (keyCode == KeyEvent.KEYCODE_HEADSETHOOK
      || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE || keyCode == KeyEvent.KEYCODE_SPACE)) {
    doPauseResume();
    show(sDefaultTimeout);
    if (mPauseButton != null)
      mPauseButton.requestFocus();
    return true;
  } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP) {
    if (mPlayer.isPlaying()) {
      mPlayer.pause();
      updatePausePlay();
    }
    return true;
  } else if (keyCode == KeyEvent.KEYCODE_BACK
      || keyCode == KeyEvent.KEYCODE_MENU) {
    hide();
    return true;
  } else {
    show(sDefaultTimeout);
  }
  return super.dispatchKeyEvent(event);
}

代码示例来源:origin: nzkozar/ExoplayerExample

private void initPlayButton() {
  btnPlay = (ImageButton) findViewById(R.id.btnPlay);
  btnPlay.requestFocus();
  btnPlay.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
      setPlayPause(!isPlaying);
    }
  });
}

代码示例来源:origin: vanilla-music/vanilla

/**
 * Set the visibility of the controls views.
 *
 * @param visible True to show, false to hide
 */
private void setControlsVisible(boolean visible)
{
  int mode = visible ? View.VISIBLE : View.GONE;
  mSlidingView.setVisibility(mode);
  mControlsVisible = visible;
  if (visible) {
    mPlayPauseButton.requestFocus();
  }
}

代码示例来源:origin: yixia/VitamioBundleStudio

private void initControllerView(View v) {
 mPauseButton = (ImageButton) v.findViewById(getResources().getIdentifier("mediacontroller_play_pause", "id", mContext.getPackageName()));
 if (mPauseButton != null) {
  mPauseButton.requestFocus();
  mPauseButton.setOnClickListener(mPauseListener);
 }
 mProgress = (SeekBar) v.findViewById(getResources().getIdentifier("mediacontroller_seekbar", "id", mContext.getPackageName()));
 if (mProgress != null) {
  if (mProgress instanceof SeekBar) {
   SeekBar seeker = (SeekBar) mProgress;
   seeker.setOnSeekBarChangeListener(mSeekListener);
  }
  mProgress.setMax(1000);
 }
 mEndTime = (TextView) v.findViewById(getResources().getIdentifier("mediacontroller_time_total", "id", mContext.getPackageName()));
 mCurrentTime = (TextView) v.findViewById(getResources().getIdentifier("mediacontroller_time_current", "id", mContext.getPackageName()));
 mFileName = (TextView) v.findViewById(getResources().getIdentifier("mediacontroller_file_name", "id", mContext.getPackageName()));
 if (mFileName != null)
  mFileName.setText(mTitle);
}

代码示例来源:origin: TedaLIEz/ParsingPlayer

protected void initView() {
  mPauseButton = (ImageButton) findViewById(R.id.pause);
  mProgress = (SeekBar) findViewById(R.id.mediacontroller_progress);
  mEndTime = (TextView) findViewById(R.id.time);
  mCurrentTime = (TextView) findViewById(R.id.time_current);
  mFullscreenButton = (ImageButton) findViewById(R.id.fullscreen);
  mPauseButton.requestFocus();
  mPauseButton.setOnClickListener(mPauseListener);
  mProgress.setOnSeekBarChangeListener(mSeekListener);
  mProgress.setMax(1000);
}

代码示例来源:origin: cyclestreets/android

/**
 * Show the controller on screen. .
 */
public void show() {
 if (!isShowing()) {
  setProgress();
  pauseBtn_.requestFocus();
  disableUnsupportedButtons();
 }
 controllerView_.setVisibility(View.VISIBLE);
 updatePausePlay();
 msgHandler_.sendEmptyMessage(SHOW_PROGRESS);
}

代码示例来源:origin: TedaLIEz/ParsingPlayer

public void show() {
  LogUtil.d(TAG,"controller shows");
  if (!mIsShowing) {
    setVisibility(VISIBLE);
    mIsShowing = true;
    post(mShowProgress);
    mPauseButton.requestFocus();
  }
}

代码示例来源:origin: jrvansuita/IconHandler

private void init() {
  selectNewIcon();
  setSelectedColor(Color.WHITE);
  selectNewGravity();
  load();
  yourImageButton.requestFocus();
}

相关文章

ImageButton类方法