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

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

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

TextView.getTransformationMethod介绍

暂无

代码示例

代码示例来源: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: grantland/android-autofittextview

private static int getMaxLines(TextView view) {
  int maxLines = -1; // No limit (Integer.MAX_VALUE also means no limit)
  TransformationMethod method = view.getTransformationMethod();
  if (method != null && method instanceof SingleLineTransformationMethod) {
    maxLines = 1;
  }
  else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
    // setMaxLines() and getMaxLines() are only available on android-16+
    maxLines = view.getMaxLines();
  }
  return maxLines;
}

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

@Test
public void shouldNotHaveTransformationMethodByDefault() {
 assertThat(textView.getTransformationMethod()).isNull();
}

代码示例来源:origin: grantland/android-autofittextview

TransformationMethod method = view.getTransformationMethod();
if (method != null) {
  text = method.getTransformation(text, view);

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

@Test
public void shouldAllowSettingATransformationMethod() {
 textView.setTransformationMethod(PasswordTransformationMethod.getInstance());
 assertThat(textView.getTransformationMethod()).isInstanceOf(PasswordTransformationMethod.class);
}

代码示例来源:origin: Jungerr/GridPasswordView

/**
 * Get the visibility of this view.
 */
private boolean getPassWordVisibility() {
  return mViewArr[0].getTransformationMethod() == null;
}

代码示例来源:origin: victorminerva/AutoResizeEditText

private static int getMaxLines(TextView view) {
  int maxLines = -1; // No limit (Integer.MAX_VALUE also means no limit)
  TransformationMethod method = view.getTransformationMethod();
  if (method != null && method instanceof SingleLineTransformationMethod) {
    maxLines = 1;
  } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
    // setMaxLines() and getMaxLines() are only available on android-16+
    maxLines = view.getMaxLines();
  }
  return maxLines;
}

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

public static float calculateTextWidth(TextView textView, String text) {
  final Paint p = new Paint();
  p.setTextSize(textView.getTextSize());

  String output = text;
  TransformationMethod method = textView.getTransformationMethod();
  if (method != null) {
    output = (String) method.getTransformation(text, textView);
  }
  return p.measureText(output);
}

代码示例来源:origin: edx/edx-app-android

if (view.getTransformationMethod() instanceof PasswordTransformationMethod) {
  return false;

代码示例来源:origin: victorminerva/AutoResizeEditText

TransformationMethod method = view.getTransformationMethod();
if (method != null) {
  text = method.getTransformation(text, view);

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

e.printStackTrace();
data.put("TransformationMethod", String.valueOf(tv.getTransformationMethod()));
data.put("Typeface", String.valueOf(tv.getTypeface()));
data.put("Urls", tv.getUrls() != null ? Arrays.toString(tv.getUrls()) : "null");

相关文章

微信公众号

最新文章

更多

TextView类方法