android.widget.EditText.getInputType()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(279)

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

EditText.getInputType介绍

暂无

代码示例

代码示例来源:origin: rey5137/material

/**
 * Get the type of the editable content.
 *
 * @see #setInputType(int)
 * @see android.text.InputType
 */
public int getInputType (){
  return mInputView.getInputType();
}

代码示例来源:origin: facebook/litho

private static void setInputTypeIfChanged(EditText editText, int inputType) {
 // Avoid redundant call to InputMethodManager#restartInput.
 if (inputType != editText.getInputType()) {
  editText.setInputType(inputType);
 }
}

代码示例来源:origin: facebook/litho

editText.setSingleLine(isSingleLine);
 editText.setRawInputType(rawInputType);
} else if (inputType != editText.getInputType()) {
 editText.setSingleLine(isSingleLine);

代码示例来源:origin: eclipse/paho.mqtt.android

Log.i(TAG, "input Type: " + promptEditText.getInputType());
promptEditText.setText(setText);

代码示例来源:origin: com.albedinsky.android/ui-widget-input

/**
 * Delegate method for {@link EditText#getInputType()}.
 */
public int getInputType() {
  return mEditText != null ? mEditText.getInputType() : mEditConfig.inputType;
}

代码示例来源:origin: com.albedinsky.android/ui

/**
 * Delegate method for {@link EditText#getInputType()}.
 */
public int getInputType() {
  return mEditText != null ? mEditText.getInputType() : mEditConfig.inputType;
}

代码示例来源:origin: conghuahuadan/CustomKeyboard

public static boolean isNumber(EditText editText) {
  int inputType = editText.getInputType();
  return inputType == NUMBER_TYPE_SIGNED_DECIMAL ||
      inputType == NUMBER_TYPE_SIGNED ||
      inputType == NUMBER_TYPE_DECIMAL ||
      inputType == NUMBER_TYPE_DEFAULT;
}

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

final EditText et = (EditText) findViewById(R.id.SearchText);
et.setInputType(et.getInputType()
  | EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS
  | EditorInfo.TYPE_TEXT_VARIATION_FILTER);

代码示例来源:origin: luhaoaimama1/zone-sdk

/**
 * 设置密码是否可见
 */
public static void passwordVisibleToggle(EditText editText) {
  Log.d("input", "passwordVisibleToggle " + editText.getInputType());
  if (editText.getInputType() == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) {
    editText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_CLASS_TEXT);
  } else {
    editText.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
  }
}

代码示例来源:origin: qyxxjd/AndroidBasicProject

/**
 * 设置密码是否可见
 */
public static void passwordVisibleToggle(EditText editText) {
  if (editText.getInputType() == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) {
    editText.setInputType(
      InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_CLASS_TEXT);
  } else {
    editText.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
  }
}

代码示例来源:origin: qyxxjd/BaseProject

/**
 * 设置密码是否可见
 */
public static void passwordVisibleToggle(@NonNull EditText editText) {
  if (editText.getInputType() == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) {
    editText.setInputType(
        InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_CLASS_TEXT);
  } else {
    editText.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
  }
}

代码示例来源:origin: MCMrARM/revolution-irc

private void updateMultilineStatus() {
  int pos = mEditText.getSelectionStart();
  if (mMultiline || mAlwaysMultiline)
    mEditText.setInputType(mEditText.getInputType()
        | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
  else
    mEditText.setInputType(mEditText.getInputType()
        & (~InputType.TYPE_TEXT_FLAG_MULTI_LINE));
  mEditText.setSelection(pos);
}

代码示例来源:origin: PrivacyApps/document-viewer

@Override
public Object getValue() {
  if ((this.input.getInputType() & InputType.TYPE_TEXT_VARIATION_PASSWORD) != 0) {
    return new PasswordEditable(this.input.getText());
  }
  return this.input.getText();
}

代码示例来源:origin: huangweicai/OkLibDemo

@Override
public boolean onTouch(View v, MotionEvent event) {
  int inType = ((EditText) v).getInputType(); // backup the input type
  ((EditText) v).setInputType(InputType.TYPE_NULL); // disable soft input
  ((EditText) v).onTouchEvent(event); // call native handler
  ((EditText) v).setInputType(inType); // restore input type
  ((EditText) v).setSelection(((EditText) v).getText().length());
  return true;
}

代码示例来源:origin: zhangxuyang321/KeyBoardDemo

@Override
  public boolean onTouch(View view, MotionEvent motionEvent) {
    int numberType = recharge_money_et.getInputType();
    recharge_money_et.setInputType(InputType.TYPE_NULL);
    keyboardUtil.showKeyboard();
    recharge_money_et.setInputType(numberType);
    return true;
  }
});

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

EditText edittext = (EditText) v;
int inType = edittext.getInputType();       // Backup the input type
edittext.setInputType(InputType.TYPE_NULL); // Disable standard keyboard
edittext.onTouchEvent(event);               // Call native handler
edittext.setInputType(inType);              // Restore input type

float x = event.getX();
float y = event.getY();
int touchPosition = edittext.getOffsetForPosition(x, y);
if (touchPosition  > 0){
  edittext.setSelection(touchPosition);
}
return true; // Consume touch event

代码示例来源:origin: zhuanghongji/custom-android-keyboard

@Override
  public boolean onTouch(View v, MotionEvent event) {
    int inputType = mPasswordEt.getInputType();
    mPasswordEt.setInputType(InputType.TYPE_NULL);
    new KeyboardUtil(mContext, mActivity, mPasswordEt).showKeyboard();
    mPasswordEt.setInputType(inputType);
    return false;
  }
});

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

private void changeInputTypeAndImeOptions(EditText fieldValue, int inputType, int imeOption) {
  if (inputType == InputType.TYPE_NULL) inputType = fieldValue.getInputType();
  fieldValue.setImeOptions(imeOption | EditorInfo.IME_FLAG_NO_FULLSCREEN);
  //Makes the trigger for the imeOptions to change while typing!
  //fieldValue.setInputType(InputType.TYPE_NULL);
  fieldValue.setInputType(inputType);
  InputMethodManager imm = (InputMethodManager)
      mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
  if (imm != null) imm.restartInput(fieldValue);
}

代码示例来源:origin: linkedin/Spyglass

@Test
  public void testSuggestionsListDisablesSpellingSuggestions() throws Exception {
    EditText input = TestUtils.getPrivateField(mRichEditor, "mMentionsEditText");
    int originalInputType = input.getInputType();

    mRichEditor.displaySuggestions(true);
    // should be no suggestions
    assertEquals(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS, input.getInputType());

    mRichEditor.displaySuggestions(false);
    // should be back to original type
    assertEquals(originalInputType, input.getInputType());
  }
}

代码示例来源:origin: gearvrf/GearVRf-Demos

private void onShowKeyboard(EditText editText) {
  switch (editText.getInputType()) {
    case EditorInfo.TYPE_CLASS_PHONE:
      mKeyboardSceneObject.setKeyboard(R.xml.numkbd);
      break;
    default:
      mKeyboardSceneObject.setKeyboard(R.xml.qwerty);
      break;
  }
  mScene.addSceneObject(mKeyboardSceneObject);
  mKeyboardSceneObject.startInput(mFrameLayoutFormSceneObject);
}

相关文章

微信公众号

最新文章

更多

EditText类方法