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

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

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

ImageView.requestFocus介绍

暂无

代码示例

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

mPauseButton.requestFocus();
mPauseButton.setOnClickListener(mPauseListener);
mTvPlay.requestFocus();
mTvPlay.setOnClickListener(v13 -> {
  doPauseResume();

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

mTvPlay.requestFocus();

代码示例来源: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: DaxiaK/MyDiary

private void initUI() {
  IV_password_number_1.requestFocus();
  switch (currentMode) {
    case CREATE_PASSWORD:
      TV_password_message.setText(getString(R.string.password_create_pwd));
      break;
    case CREATE_PASSWORD_WITH_VERIFY:
      TV_password_message.setText(getString(R.string.password_create_pwd_with_verify));
      break;
    case VERIFY_PASSWORD:
      TV_password_message.setText(getString(R.string.password_verify_pwd));
      But_password_key_cancel.setVisibility(View.INVISIBLE);
      But_password_key_cancel.setOnClickListener(null);
      break;
    case REMOVE_PASSWORD:
      TV_password_message.setText(getString(R.string.password_remove_pwd));
      break;
  }
}

代码示例来源:origin: rockon999/LeanbackLauncher

public void requestUninstallIconFocus(BannerView curView, EditableAppsRowView activeItems) {
  this.mUninstallIcon.requestFocus();
  setBannerUninstallModeWithAnimation(true, curView, activeItems);
}

代码示例来源:origin: MoMoWait/LeanbackLauncher

public void requestUninstallIconFocus(BannerView curView, ActiveItemsRowView activeItems) {
  this.mUninstallIcon.requestFocus();
  setBannerUninstallModeWithAnimation(true, curView, activeItems);
}

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

iv2=(ImageView)findViewById(R.id.ImageView2);
iv1.requestFocus();
iv1.setBackgroundResource(R.drawable.hilight);
  if(current_position==1)
    iv2.requestFocus();
    current_position=2;
  }else if(current_position==2)
    iv1.requestFocus();
    current_position=1;
  if(current_position==1)
    iv2.requestFocus();
    current_position=2;
  }else if(current_position==2)
    iv1.requestFocus();
    current_position=1;

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

iv2=(ImageView)findViewById(R.id.ImageView2); 
iv1.requestFocus(); 
iv1.setBackgroundResource(R.drawable.hilight); 
  if(current_position==1) 
    iv2.requestFocus(); 
    current_position=2; 
  }else if(current_position==2) 
    iv1.requestFocus(); 
    current_position=1; 
  if(current_position==1) 
    iv2.requestFocus(); 
    current_position=2; 
  }else if(current_position==2) 
    iv1.requestFocus(); 
    current_position=1;

代码示例来源:origin: yoyiyi/bilisoleil

mPauseButton.requestFocus();
mPauseButton.setOnClickListener(mPauseListener);
mTvPlay.requestFocus();
mTvPlay.setOnClickListener(v13 -> {
  doPauseResume();

代码示例来源:origin: fire3/sailorcast

@Override
  public void onClick(View v) {
    mVideoClose.requestFocus();
    mVideoClose.setPressed(true);
    mVideoTitle.requestFocus();
    mVideoTitle.setPressed(true);
    finish();
  }
});

代码示例来源:origin: yoyiyi/bilisoleil

mTvPlay.requestFocus();

代码示例来源:origin: huangfangyi/YiChat

@Override
  public void onSoftKeyBoardChange(int softKeybardHeight, boolean isShow) {
    if (isShow) {
      ThreadUtil.runInUIThread(new Runnable() {
        @Override
        public void run() {
          llInputSoft.animate().translationYBy(-editMessage.getHeight() / 2).setDuration(100).start();
          flChatList.animate().translationYBy(-editMessage.getHeight() / 2).setDuration(100).start();
        }
      }, duration);
    } else {
      btnChat.requestFocus();
      vaBottomBar.setDisplayedChild(0);
      llInputSoft.animate().translationYBy(editMessage.getHeight() / 2).setDuration(100).start();
      flChatList.animate().translationYBy(editMessage.getHeight() / 2).setDuration(100).start();
    }
  }
});

代码示例来源:origin: abrenoch/hyperion-android-grabber

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  mMediaProjectionManager = (MediaProjectionManager)
                  getSystemService(Context.MEDIA_PROJECTION_SERVICE);
  ImageView iv = findViewById(R.id.power_toggle);
  iv.setOnClickListener(this);
  iv.setOnFocusChangeListener(this);
  iv.setFocusable(true);
  iv.requestFocus();
  setImageViews(mRecorderRunning, false);
  LocalBroadcastManager.getInstance(this).registerReceiver(
      mMessageReceiver, new IntentFilter(HyperionScreenService.BROADCAST_FILTER));
  checkForInstance();
}

代码示例来源:origin: huangfangyi/YiChat

@Override
  public void onSoftKeyBoardChange(int softKeybardHeight, boolean isShow) {
    if (isShow) {
      ThreadUtil.runInUIThread(new Runnable() {
        @Override
        public void run() {
          if (!isKeybord) {
            isKeybord = true;
            llInputSoft.animate().translationYBy(-editMessage.getHeight() / 3).setDuration(100).start();
            flChatList.animate().translationYBy(-editMessage.getHeight() / 3).setDuration(100).start();
          }
        }
      }, duration);
    } else {
      btnChat.requestFocus();
      vaBottomBar.setDisplayedChild(0);
      llInputSoft.animate().translationYBy(editMessage.getHeight() / 3).setDuration(100).start();
      flChatList.animate().translationYBy(editMessage.getHeight() / 3).setDuration(100).start();
      isKeybord = false;
    }
  }
});

代码示例来源:origin: qiubiteme/android_api_demos

public void run() {
    final float centerX = mContainer.getWidth() / 2.0f;
    final float centerY = mContainer.getHeight() / 2.0f;
    Rotate3dAnimation rotation;
    if (mPosition > -1) {
      mPhotosList.setVisibility(View.GONE);
      mImageView.setVisibility(View.VISIBLE);
      mImageView.requestFocus();
      rotation = new Rotate3dAnimation(90, 180, centerX, centerY, 310.0f, false);
    } else {
      mImageView.setVisibility(View.GONE);
      mPhotosList.setVisibility(View.VISIBLE);
      mPhotosList.requestFocus();
      rotation = new Rotate3dAnimation(90, 0, centerX, centerY, 310.0f, false);
    }
    rotation.setDuration(500);
    rotation.setFillAfter(true);
    rotation.setInterpolator(new DecelerateInterpolator());
    mContainer.startAnimation(rotation);
  }
}

代码示例来源:origin: li2/learning-android-open-source

public void run() {
    final float centerX = mContainer.getWidth() / 2.0f;
    final float centerY = mContainer.getHeight() / 2.0f;
    Rotate3dAnimation rotation;
    
    if (mPosition > -1) {
      mPhotosList.setVisibility(View.GONE);
      mImageView.setVisibility(View.VISIBLE);
      mImageView.requestFocus();
      rotation = new Rotate3dAnimation(90, 180, centerX, centerY, 310.0f, false);
    } else {
      mImageView.setVisibility(View.GONE);
      mPhotosList.setVisibility(View.VISIBLE);
      mPhotosList.requestFocus();
      rotation = new Rotate3dAnimation(90, 0, centerX, centerY, 310.0f, false);
    }
    rotation.setDuration(500);
    rotation.setFillAfter(true);
    rotation.setInterpolator(new DecelerateInterpolator());
    mContainer.startAnimation(rotation);
  }
}

代码示例来源:origin: abrenoch/hyperion-android-grabber

private void initActivity() {
  // assume the recorder is not running until we are notified otherwise
  mRecorderRunning = false;
  setContentView(R.layout.activity_main);
  AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
  mMediaProjectionManager = (MediaProjectionManager)
                  getSystemService(Context.MEDIA_PROJECTION_SERVICE);
  ImageView iv = findViewById(R.id.power_toggle);
  iv.setOnClickListener(this);
  iv.setOnFocusChangeListener(this);
  iv.setFocusable(true);
  iv.requestFocus();
  ImageButton ib = findViewById(R.id.settingsButton);
  ib.setOnClickListener(this);
  ib.setOnFocusChangeListener(this);
  ib.setFocusable(true);
  setImageViews(mRecorderRunning, false);
  LocalBroadcastManager.getInstance(this).registerReceiver(
      mMessageReceiver, new IntentFilter(BROADCAST_FILTER));
  // request an update on the running status
  checkForInstance();
}

代码示例来源:origin: Hankkin/GradationTitleBar

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  getWindow().requestFeature(Window.FEATURE_NO_TITLE);
  StatusBarUtil.setImgTransparent(this);
  setContentView(R.layout.activity_qqspeak);
  scrollView = (GradationScrollView) findViewById(R.id.scrollview);
  listView = (ListView) findViewById(R.id.listview);
  textView = (TextView) findViewById(R.id.textview);
  ivBanner = (ImageView) findViewById(R.id.iv_banner);
  ivBanner.setFocusable(true);
  ivBanner.setFocusableInTouchMode(true);
  ivBanner.requestFocus();
  initListeners();
  initData();
}

代码示例来源:origin: yoyiyi/bilisoleil

@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: stackoverflow.com

setupGlassGroup();
setupDesc();
bgImageView.requestFocus();
primaryStage.setTitle("Magnifying Glass");
primaryStage.setWidth(image.getWidth() / 2);
      magGlass.setSmooth(magGlass.isSmooth());
    bgImageView.requestFocus();

相关文章

ImageView类方法