當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageView.requestFocus方法代碼示例

本文整理匯總了Java中android.widget.ImageView.requestFocus方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageView.requestFocus方法的具體用法?Java ImageView.requestFocus怎麽用?Java ImageView.requestFocus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.ImageView的用法示例。


在下文中一共展示了ImageView.requestFocus方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initControllerView

import android.widget.ImageView; //導入方法依賴的package包/類
private void initControllerView(View v) {

    mPauseButton = (ImageButton) v.findViewById(R.id.media_controller_play_pause);
    mTvPlay = (ImageView) v.findViewById(R.id.media_controller_tv_play);
    if (mPauseButton != null && mTvPlay != null) {
      mPauseButton.requestFocus();
      mPauseButton.setOnClickListener(mPauseListener);
      mTvPlay.requestFocus();
      mTvPlay.setOnClickListener(v13 -> {
        doPauseResume();
        show(sDefaultTimeout);
      });
    }

    mProgress = (SeekBar) v.findViewById(R.id.media_controller_seekbar);
    if (mProgress != null) {
      if (mProgress instanceof SeekBar) {
        SeekBar seeker = (SeekBar) mProgress;
        seeker.setOnSeekBarChangeListener(mSeekListener);
        seeker.setThumbOffset(1);
      }
      mProgress.setMax(1000);
    }

    mEndTime = (TextView) v.findViewById(R.id.media_controller_time_total);
    mCurrentTime = (TextView) v
        .findViewById(R.id.media_controller_time_current);
    mTitleView = (TextView) v.findViewById(R.id.media_controller_title);
    if (mTitleView != null) {
      mTitleView.setText(mTitle);
    }

    LinearLayout mDanmakuLayout = (LinearLayout) v.findViewById(
        R.id.media_controller_danmaku_layout);
    ImageView mDanmakuImage = (ImageView) v.findViewById(R.id.media_controller_danmaku_switch);
    TextView mDanmakuText = (TextView) v.findViewById(R.id.media_controller_danmaku_text);
    mDanmakuLayout.setOnClickListener(v1 -> {

      if (mDanmakuShow) {
        mDanmakuImage.setImageResource(R.drawable.bili_player_danmaku_is_open);
        mDanmakuText.setText("彈幕開");
        mDanmukuSwitchListener.setDanmakushow(true);
        mDanmakuShow = false;
      } else {
        mDanmakuImage.setImageResource(R.drawable.bili_player_danmaku_is_closed);
        mDanmakuText.setText("彈幕關");
        mDanmukuSwitchListener.setDanmakushow(false);
        mDanmakuShow = true;
      }
    });

    mBack = (ImageView) v.findViewById(R.id.media_controller_back);
    mBack.setOnClickListener(v12 -> mVideoBackListener.back());
  }
 
開發者ID:MUFCRyan,項目名稱:BilibiliClient,代碼行數:55,代碼來源:MediaController.java

示例2: initControllerView

import android.widget.ImageView; //導入方法依賴的package包/類
private void initControllerView(View v) {
    mPauseButton = (ImageView) v.findViewById(R.id.pause);
    if (mPauseButton != null) {
        mPauseButton.requestFocus();
        mPauseButton.setOnClickListener(mPauseListener);
    }
    
    mFullscreenButton = (ImageView) v.findViewById(R.id.fullscreen);
    if (mFullscreenButton != null) {
        mFullscreenButton.requestFocus();
        mFullscreenButton.setOnClickListener(mFullscreenListener);
    }

    mFfwdButton = (ImageView) v.findViewById(R.id.ffwd);
    if (mFfwdButton != null) {
        mFfwdButton.setOnClickListener(mFfwdListener);
        if (!mFromXml) {
            mFfwdButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
        }
    }

    mRewButton = (ImageView) v.findViewById(R.id.rew);
    if (mRewButton != null) {
        mRewButton.setOnClickListener(mRewListener);
        if (!mFromXml) {
            mRewButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
        }
    }

    // By default these are hidden. They will be enabled when setPrevNextListeners() is called 
    mNextButton = (ImageView) v.findViewById(R.id.next);
    if (mNextButton != null && !mFromXml && !mListenersSet) {
        mNextButton.setVisibility(View.GONE);
    }
    mPrevButton = (ImageView) v.findViewById(R.id.prev);
    if (mPrevButton != null && !mFromXml && !mListenersSet) {
        mPrevButton.setVisibility(View.GONE);
    }

    mProgress = (SeekBar) v.findViewById(R.id.mediacontroller_progress);
    if (mProgress != null) {
        if (mProgress instanceof SeekBar) {
            SeekBar seeker = (SeekBar) mProgress;
            seeker.setOnSeekBarChangeListener(mSeekListener);
        }
        mProgress.setMax(1000);
    }

    mEndTime = (TextView) v.findViewById(R.id.time);
    mCurrentTime = (TextView) v.findViewById(R.id.time_current);
    mFormatBuilder = new StringBuilder();
    mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());

    installPrevNextListeners();
}
 
開發者ID:adarshgumashta,項目名稱:Facebook-Video-Downloader,代碼行數:56,代碼來源:VideoControllerView.java


注:本文中的android.widget.ImageView.requestFocus方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。