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

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

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

ImageButton.performClick介绍

暂无

代码示例

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
public boolean onDoubleTap(MotionEvent e) {
  if (DEBUG) Log.d(TAG, "onDoubleTap() called with: e = [" + e + "]" + "rawXy = " + e.getRawX() + ", " + e.getRawY() + ", xy = " + e.getX() + ", " + e.getY());
  if (e.getX() > playerImpl.getRootView().getWidth() * 2 / 3) {
    playerImpl.onFastForward();
  } else if (e.getX() < playerImpl.getRootView().getWidth() / 3) {
    playerImpl.onFastRewind();
  } else {
    playerImpl.getPlayPauseButton().performClick();
  }
  return true;
}

代码示例来源:origin: fossasia/pslab-android

@Override
  public boolean performClick() {
    return super.performClick();
  }
}

代码示例来源:origin: techstar-cloud/memorize-en

@Override
  public void onReceive(Context context, Intent intent) {
    if (floatingButton != null)
      floatingButton.performClick();
  }
};

代码示例来源:origin: andreadec/MusicPlayer

@Override
public boolean performClick() {
  //toggle();
  return super.performClick();
}

代码示例来源:origin: RWebRTC/WebRTC-Android-Learn

@Override
 public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
  if (i == EditorInfo.IME_ACTION_DONE) {
   addFavoriteButton.performClick();
   return true;
  }
  return false;
 }
});

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

LinearLayout contentLayoutAddressPostal = (LinearLayout)findViewById(R.id.se_contentAdressPostal);
  ImageButton imbtRemoveAddress2 = (ImageButton)findViewById(R.id.sfsp2_ivHide);
   if(imbtRemoveAddress2.getParent()==contentLayoutAddressPostal){
    imbtRemoveAddress2.performClick();
                 ............................

代码示例来源:origin: Meiqia/MeiqiaSDK-Android

@Override
  public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (actionId == EditorInfo.IME_ACTION_DONE) {
      mSendTextBtn.performClick();
      MQUtils.closeKeyboard(MQConversationActivity.this);
      return true;
    }
    return false;
  }
});

代码示例来源:origin: com.actionbarsherlock/actionbarsherlock

@Override
public boolean performClick() {
  if (super.performClick()) {
    return true;
  }
  playSoundEffect(SoundEffectConstants.CLICK);
  showOverflowMenu();
  return true;
}

代码示例来源:origin: com.willowtreeapps/oak-demos

@Override
public boolean performClick() {
  if (super.performClick()) {
    return true;
  }
  playSoundEffect(SoundEffectConstants.CLICK);
  showOverflowMenu();
  return true;
}

代码示例来源:origin: konradrenner/kolabnotes-android

@Override
public boolean performClick() {
  if (mMode == ToolButtonMode.MODE_RADIO_BUTTON) {
    setChecked(true);
  } else if (mMode == ToolButtonMode.MODE_CHECK_BOX) {
    toggle();
  }
  return super.performClick();
}

代码示例来源:origin: veryyoung/DingDingLuckyMoney

@Override
  protected void afterHookedMethod(MethodHookParam param) throws Throwable {
    if (PreferencesUtils.quickOpen()) {
      ImageButton imageButton = (ImageButton) findFirstFieldByExactType(param.thisObject.getClass(), ImageButton.class).get(param.thisObject);
      if (imageButton.isClickable()) {
        imageButton.performClick();
      }
    }
  }
});

代码示例来源:origin: LongDinhF/Hamburger-Button

@Override
public boolean performClick() {
  if (isSlideLeftToRight()) {
    animateLeftToRight();
  } else {
    animateRightToLeft();
  }
  return super.performClick();
}

代码示例来源:origin: jorgegil96/All-NBA

@Test
public void onClickBold_withoutSelectedBody() {
  final String text = "This is a line of text.";
  EditText editText = (EditText) activity.findViewById(R.id.edit_response);
  ImageButton boldBtn = (ImageButton) activity.findViewById(R.id.button_bold);
  editText.setText(text);
  editText.setSelection(10);
  boldBtn.performClick();
  assertEquals("This is a ****line of text.", editText.getText().toString());
  assertEquals(12, editText.getSelectionStart());
}

代码示例来源:origin: jorgegil96/All-NBA

@Test
public void onClickItalics_withoutSelectedBody() {
  final String text = "This is a line of text.";
  EditText editText = (EditText) activity.findViewById(R.id.edit_response);
  ImageButton italicsBtn = (ImageButton) activity.findViewById(R.id.button_italic);
  editText.setText(text);
  editText.setSelection(10);
  italicsBtn.performClick();
  assertEquals("This is a **line of text.", editText.getText().toString());
  assertEquals(11, editText.getSelectionStart());
}

代码示例来源:origin: jorgegil96/All-NBA

@Test
public void onClickBold_withSelectedBody() {
  final String text = "This is a line of text.";
  EditText editText = (EditText) activity.findViewById(R.id.edit_response);
  ImageButton boldBtn = (ImageButton) activity.findViewById(R.id.button_bold);
  editText.setText(text);
  editText.setSelection(10, 14);
  boldBtn.performClick();
  assertEquals("This is a **line** of text.", editText.getText().toString());
  assertEquals(16, editText.getSelectionStart());
}

代码示例来源:origin: jorgegil96/All-NBA

@Test
public void onClickItalics_withSelectedBody() {
  final String text = "This is a line of text.";
  EditText editText = (EditText) activity.findViewById(R.id.edit_response);
  ImageButton italicsBtn = (ImageButton) activity.findViewById(R.id.button_italic);
  editText.setText(text);
  editText.setSelection(10, 14);
  italicsBtn.performClick();
  assertEquals("This is a *line* of text.", editText.getText().toString());
  assertEquals(15, editText.getSelectionStart());
}

代码示例来源:origin: jorgegil96/All-NBA

@Test
public void onClickStrikethrough_withoutSelectedBody() {
  final String text = "This is a line of text.";
  EditText editText = (EditText) activity.findViewById(R.id.edit_response);
  ImageButton strikeBtn = (ImageButton) activity.findViewById(R.id.button_strikethrough);
  editText.setText(text);
  editText.setSelection(10);
  strikeBtn.performClick();
  assertEquals("This is a ~~~~line of text.", editText.getText().toString());
  assertEquals(12, editText.getSelectionStart());
}

代码示例来源:origin: jorgegil96/All-NBA

@Test
public void onClickQuote_withSelection() {
  final String text = "This is a line of text.";
  EditText editText = (EditText) activity.findViewById(R.id.edit_response);
  ImageButton quoteBtn = (ImageButton) activity.findViewById(R.id.button_quotes);
  editText.setText(text);
  editText.setSelection(5, 10);
  quoteBtn.performClick();
  assertEquals("This > is a line of text.", editText.getText().toString());
  assertEquals(7, editText.getSelectionStart());
}

代码示例来源:origin: jorgegil96/All-NBA

@Test
public void onClickQuote_withEmptyBody() {
  final String text = "";
  EditText editText = (EditText) activity.findViewById(R.id.edit_response);
  ImageButton quoteBtn = (ImageButton) activity.findViewById(R.id.button_quotes);
  editText.setText(text);
  quoteBtn.performClick();
  assertEquals("> ", editText.getText().toString());
  assertEquals(2, editText.getSelectionStart());
}

代码示例来源:origin: jorgegil96/All-NBA

@Test
public void onLinkClick_noSelection_openDialog() {
  ImageButton linkButton = (ImageButton) activity.findViewById(R.id.button_link);
  linkButton.performClick();
  ShadowAlertDialog shadowDialog = (ShadowAlertDialog) Shadows.shadowOf(ShadowAlertDialog
      .getLatestDialog());
  EditText editText = shadowDialog.getView().findViewById(R.id.edit_text);
  EditText editLink = shadowDialog.getView().findViewById(R.id.edit_link);
  assertEquals(resources.getString(R.string.add_link), shadowDialog.getTitle());
  assertNotNull(editText);
  assertNotNull(editLink);
}

相关文章

ImageButton类方法