com.google.android.material.textfield.TextInputLayout.getEditText()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(318)

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

TextInputLayout.getEditText介绍

暂无

代码示例

代码示例来源:origin: pranavpandey/dynamic-support

/**
 * Tint an {@link TextInputLayout} by changing its label and focus colors according to the
 * supplied color.
 *
 * @param textInputLayout The text input layout to be colorized.
 * @param color The color to be used.
 */
public static void setColor(@NonNull TextInputLayout textInputLayout, @ColorInt int color) {
  try {
    Field focusedTextColorField =
        TextInputLayout.class.getDeclaredField("focusedTextColor");
    focusedTextColorField.setAccessible(true);
    focusedTextColorField.set(textInputLayout, ColorStateList.valueOf(color));
    Method updateLabelStateMethod = TextInputLayout.class.getDeclaredMethod(
        "updateLabelState", boolean.class, boolean.class);
    updateLabelStateMethod.setAccessible(true);
    updateLabelStateMethod.invoke(textInputLayout, false, true);
  } catch (Exception ignored) {
  }
  if (textInputLayout.getEditText() != null) {
    setColor(textInputLayout.getEditText(), color);
  }
  setHint(textInputLayout, color);
}

代码示例来源:origin: zas023/CocoBill

/**
 * 显示修改密码对话框
 */
public void showChangeDialog() {
  new MaterialDialog.Builder(mContext)
      .title("修改密码")
      .customView(R.layout.dialog_change_password, false)
      .positiveText("确定")
      .onPositive((dialog, which) -> {
        View view = dialog.getCustomView();
        TextInputLayout til = view.findViewById(R.id.change_til_password);
        TextInputLayout til1 = view.findViewById(R.id.change_til_repassword);
        String passport = til.getEditText().getText().toString();
        String repaspsort = til.getEditText().getText().toString();
        if (passport.equals("") || repaspsort.equals("")) {
          ToastUtils.show(mContext, "不能为空!");
        } else if (passport.equals(repaspsort)) {
          //修改密码
          changePw(passport);
        } else {
          ToastUtils.show(mContext, "两次输入不一致!");
        }
      })
      .negativeText("取消")
      .show();
}

相关文章