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

x33g5p2x  于2022-01-29 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(217)

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

TextView.getInputType介绍

暂无

代码示例

代码示例来源:origin: facebook/facebook-android-sdk

private static boolean isPostalAddress(TextView view) {
  int inputType = view.getInputType();
  return inputType == InputType.TYPE_TEXT_VARIATION_POSTAL_ADDRESS;
}

代码示例来源:origin: facebook/facebook-android-sdk

private static boolean isPhoneNumber(TextView view) {
  int inputType = view.getInputType();
  return inputType == InputType.TYPE_CLASS_PHONE;
}

代码示例来源:origin: facebook/facebook-android-sdk

private static boolean isPersonName(TextView view) {
  int inputType = view.getInputType();
  return inputType == InputType.TYPE_TEXT_VARIATION_PERSON_NAME;
}

代码示例来源:origin: facebook/facebook-android-sdk

private static boolean isPassword(TextView view) {
  int inputType = view.getInputType();
  if (inputType == InputType.TYPE_TEXT_VARIATION_PASSWORD) {
    return true;
  }
  TransformationMethod method = view.getTransformationMethod();
  return method instanceof PasswordTransformationMethod;
}

代码示例来源:origin: facebook/facebook-android-sdk

private static boolean isEmail(TextView view) {
  int inputType = view.getInputType();
  if (inputType == InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS) {
    return true;
  }
  String text = ViewHierarchy.getTextOfView(view);
  if (text == null || text.length() == 0) {
    return false;
  }
  return android.util.Patterns.EMAIL_ADDRESS.matcher(text).matches();
}

代码示例来源:origin: square/assertj-android

public S hasInputType(int type) {
 isNotNull();
 int actualType = actual.getInputType();
 assertThat(actualType) //
   .overridingErrorMessage("Expected input type <%s> but was <%s>.", type, actualType) //
   .isEqualTo(type);
 return myself;
}

代码示例来源:origin: android-hacker/VirtualXposed

private boolean isSingleLine(TextView textView) {
  boolean singleLine;
  try {
    singleLine = Reflect.on(textView).get("mSingleLine");
  } catch (Exception e) {
    singleLine = (textView.getInputType() & EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE) != 0;
  }
  return singleLine;
}

代码示例来源:origin: robolectric/robolectric

@Test
public void testGetInputType() throws Exception {
 assertThat(textView.getInputType()).isNotEqualTo(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
 textView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
 assertThat(textView.getInputType()).isEqualTo(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
}

代码示例来源:origin: bzsome/VirtualApp-x326

/***
 * @param textView textview
 * @return 是否是单行
 */
public static boolean isSingleLine(TextView textView) {
  if (textView == null) return false;
  if (textView instanceof BaseTextView) {
    return ((BaseTextView) textView).isSingleLine();
  }
  if (textView == null) {
    return false;
  }
  int type = textView.getInputType();
  return (type & EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE) == EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
}

代码示例来源:origin: darkskygit/VirtualApp

/***
 * @param textView textview
 * @return 是否是单行
 */
public static boolean isSingleLine(TextView textView) {
  if (textView == null) return false;
  if (textView instanceof BaseTextView) {
    return ((BaseTextView) textView).isSingleLine();
  }
  if (textView == null) {
    return false;
  }
  int type = textView.getInputType();
  return (type & EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE) == EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
}

代码示例来源:origin: com.squareup.assertj/assertj-android

public S hasInputType(int type) {
 isNotNull();
 int actualType = actual.getInputType();
 assertThat(actualType) //
   .overridingErrorMessage("Expected input type <%s> but was <%s>.", type, actualType) //
   .isEqualTo(type);
 return myself;
}

代码示例来源:origin: bzsome/VirtualApp-x326

private boolean isSingleLine(TextView textView) {
  boolean singleLine;
  try {
    singleLine = Reflect.on(textView).get("mSingleLine");
  } catch (Exception e) {
    singleLine = (textView.getInputType() & EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE) != 0;
  }
  return singleLine;
}

代码示例来源:origin: darkskygit/VirtualApp

private boolean isSingleLine(TextView textView) {
  boolean singleLine;
  try {
    singleLine = Reflect.on(textView).get("mSingleLine");
  } catch (Exception e) {
    singleLine = (textView.getInputType() & EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE) != 0;
  }
  return singleLine;
}

代码示例来源:origin: appium/appium-espresso-driver

public boolean isPassword() {
  return (view instanceof TextView) && isPasswordInputType(((TextView) view).getInputType());
}

代码示例来源:origin: jbruchanov/AnUitor

values.put("AutoLinkMask", translator.linkMask(tv.getAutoLinkMask()));
values.put("Ellipsize", String.valueOf(tv.getEllipsize()));
values.put("InputType", translator.inputType(tv.getInputType()));
values.put("TextScaleX", tv.getTextScaleX());
values.put("CompoundDrawablePadding", tv.getCompoundDrawablePadding());

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

if(txtValue.getInputType()==InputType.TYPE_NULL){
  txtValue.setInputType(InputType.TYPE_CLASS_TEXT);
  txtValue.invalidate();

相关文章

TextView类方法