本文整理了Java中com.google.android.material.textfield.TextInputLayout.setErrorEnabled()
方法的一些代码示例,展示了TextInputLayout.setErrorEnabled()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextInputLayout.setErrorEnabled()
方法的具体详情如下:
包路径:com.google.android.material.textfield.TextInputLayout
类名称:TextInputLayout
方法名:setErrorEnabled
暂无
代码示例来源:origin: stripe/stripe-android
@Override
public void displayErrorMessage(@Nullable String message) {
if (message == null) {
textInputLayout.setErrorEnabled(false);
} else {
textInputLayout.setError(message);
}
}
}
代码示例来源:origin: proninyaroslav/libretorrent
@Override
public void onTextChanged(CharSequence s, int start, int before, int count)
{
filterFieldLayout.setErrorEnabled(false);
filterFieldLayout.setError(null);
}
代码示例来源:origin: proninyaroslav/libretorrent
@Override
public void onTextChanged(CharSequence s, int start, int before, int count)
{
fileNameLayout.setErrorEnabled(false);
fileNameLayout.setError(null);
}
代码示例来源:origin: proninyaroslav/libretorrent
@Override
public void onTextChanged(CharSequence s, int start, int before, int count)
{
trackersLayout.setErrorEnabled(false);
trackersLayout.setError(null);
}
代码示例来源:origin: proninyaroslav/libretorrent
@Override
public void onTextChanged(CharSequence s, int start, int before, int count)
{
webSeedsLayout.setErrorEnabled(false);
webSeedsLayout.setError(null);
}
代码示例来源:origin: proninyaroslav/libretorrent
@Override
public void onTextChanged(CharSequence s, int start, int before, int count)
{
urlFieldLayout.setErrorEnabled(false);
urlFieldLayout.setError(null);
}
代码示例来源:origin: proninyaroslav/libretorrent
@Override
public void onTextChanged(CharSequence s, int start, int before, int count)
{
fieldLayout.setErrorEnabled(false);
fieldLayout.setError(null);
}
代码示例来源:origin: MCMrARM/revolution-irc
@Override
public void afterTextChanged(Editable s) {
getEntry().mNameDuplicateError = false;
mNameCtr.setErrorEnabled(false);
}
}
代码示例来源:origin: proninyaroslav/libretorrent
private boolean checkFilterField(String s, boolean isRegex, TextInputLayout layout)
{
if (s == null || layout == null || TextUtils.isEmpty(s))
return true;
if (isRegex) {
try {
Pattern.compile(s);
} catch (PatternSyntaxException e) {
layout.setErrorEnabled(true);
layout.setError(e.getMessage());
layout.requestFocus();
return false;
}
}
layout.setErrorEnabled(false);
layout.setError(null);
return true;
}
代码示例来源:origin: proninyaroslav/libretorrent
private void checkEditTextField(CharSequence s)
{
if (TextUtils.isEmpty(s)) {
layoutTorrentName.setErrorEnabled(true);
layoutTorrentName.setError(getString(R.string.error_field_required));
layoutTorrentName.requestFocus();
} else {
layoutTorrentName.setErrorEnabled(false);
layoutTorrentName.setError(null);
}
}
代码示例来源:origin: MCMrARM/revolution-irc
@Override
public void bind(BasicEntry entry) {
mName.removeTextChangedListener(mNameTextWatcher);
mName.setText(entry.mName);
mName.addTextChangedListener(mNameTextWatcher);
if (entry.mNameDuplicateError)
mNameCtr.setError(mNameCtr.getResources().getString(R.string.notification_rule_name_collision));
else
mNameCtr.setErrorEnabled(false);
}
代码示例来源:origin: proninyaroslav/libretorrent
private boolean checkEditTextField(String s, TextInputLayout layout)
{
if (s == null || layout == null)
return false;
if (TextUtils.isEmpty(s)) {
layout.setErrorEnabled(true);
layout.setError(getString(R.string.error_empty_link));
layout.requestFocus();
return false;
}
layout.setErrorEnabled(false);
layout.setError(null);
return true;
}
代码示例来源:origin: proninyaroslav/libretorrent
private boolean checkUrlField(String s, TextInputLayout layout)
{
if (s == null || layout == null)
return false;
if (TextUtils.isEmpty(s)) {
layout.setErrorEnabled(true);
layout.setError(getString(R.string.error_empty_link));
layout.requestFocus();
return false;
}
layout.setErrorEnabled(false);
layout.setError(null);
return true;
}
代码示例来源:origin: MCMrARM/revolution-irc
@Override
public void afterTextChanged(Editable s) {
if (mMode.getSelectedItemPosition() != MatchEntry.MODE_REGEX ||
MatchEntry.validateRegex(s.toString(), mCaseSensitive.isChecked())) {
mTextCtr.setErrorEnabled(false);
} else {
mTextCtr.setError(mTextCtr.getResources().getString(R.string.notification_rule_regex_invalid));
}
}
代码示例来源:origin: proninyaroslav/libretorrent
private void checkEditTextField(CharSequence s)
{
if (TextUtils.isEmpty(s)) {
layoutTorrentName.setErrorEnabled(true);
layoutTorrentName.setError(getString(R.string.error_field_required));
layoutTorrentName.requestFocus();
if (callback != null)
callback.onTorrentInfoChangesUndone();
} else {
layoutTorrentName.setErrorEnabled(false);
layoutTorrentName.setError(null);
name = s.toString();
}
}
代码示例来源:origin: Ilhasoft/data-binding-validator
public static void setError(TextView textView, String errorMessage) {
TextInputLayout textInputLayout = getTextInputLayout(textView);
if (textInputLayout != null) {
textInputLayout.setErrorEnabled(!TextUtils.isEmpty(errorMessage));
textInputLayout.setError(errorMessage);
} else {
textView.setError(errorMessage);
}
}
代码示例来源:origin: proninyaroslav/libretorrent
private boolean checkFileNameField()
{
if (fileNameEditText == null || fileNameLayout == null)
return false;
if (TextUtils.isEmpty(fileNameEditText.getText())) {
fileNameLayout.setErrorEnabled(true);
fileNameLayout.setError(getString(R.string.file_name_is_empty));
fileNameLayout.requestFocus();
return false;
}
fileNameLayout.setErrorEnabled(false);
fileNameLayout.setError(null);
return true;
}
}
代码示例来源:origin: michael-rapp/AndroidMaterialDialog
/**
* Shows an error text.
*/
private void showErrorText(@Nullable final CharSequence errorText) {
if (textInputLayout != null) {
if (TextUtils.isEmpty(errorText)) {
textInputLayout.setError(null);
textInputLayout.setErrorEnabled(false);
adaptHelperTextColor();
} else {
textInputLayout.setHelperText(null);
textInputLayout.setHelperTextEnabled(false);
textInputLayout.setError(errorText);
textInputLayout.setErrorEnabled(true);
}
}
}
代码示例来源:origin: WellingtonCosta/convalida
public static void setError(EditText editText, String errorMessage) {
TextInputLayout layout = getTextInputLayout(editText);
if (layout != null) {
layout.setErrorEnabled(errorMessage != null);
layout.setError(errorMessage);
} else {
editText.setError(errorMessage);
}
}
代码示例来源:origin: proninyaroslav/libretorrent
@Override
public void onTextChanged(CharSequence s, int start, int before, int count)
{
fieldLayout.setErrorEnabled(false);
fieldLayout.setError(null);
/* Clear selection of invalid url */
Spannable text = field.getText();
ForegroundColorSpan[] errorSpans = text.getSpans(0, text.length(),
ForegroundColorSpan.class);
for (ForegroundColorSpan span : errorSpans) {
text.removeSpan(span);
}
}
内容来源于网络,如有侵权,请联系作者删除!