任何人都可以帮助解决edittext标签浮动问题,根据我的要求,当显示错误文本时,提示文本应该在editbox中。现在发生了什么,每当我显示错误文本时标签也在移动,我不想移动labeluntil并且除非用户开始输入
截图来自谷歌设计界面 http://www.google.com/design/spec/components/text-fields.html#text-fields-single-line-text-field
答案 0 :(得分:0)
final boolean hasText = mEditText != null && !TextUtils.isEmpty(mEditText.getText());
final boolean isFocused = arrayContains(getDrawableState(), android.R.attr.state_focused);
final boolean isErrorShowing = !TextUtils.isEmpty(getError());
if (mDefaultTextColor != null) {
mCollapsingTextHelper.setExpandedTextColor(mDefaultTextColor.getDefaultColor());
}
if (mCounterOverflowed && mCounterView != null) {
mCollapsingTextHelper.setCollapsedTextColor(mCounterView.getCurrentTextColor());
} else if (isErrorShowing && mErrorView != null) {
mCollapsingTextHelper.setCollapsedTextColor(mErrorView.getCurrentTextColor());
} else if (isFocused && mFocusedTextColor != null) {
mCollapsingTextHelper.setCollapsedTextColor(mFocusedTextColor.getDefaultColor());
} else if (mDefaultTextColor != null) {
mCollapsingTextHelper.setCollapsedTextColor(mDefaultTextColor.getDefaultColor());
}
if (hasText || isFocused || isErrorShowing) {
// We should be showing the label so do so if it isn't already
collapseHint(animate);
} else {
// We should not be showing the label so hide it
expandHint(animate);
}
我检查了代码,这是TextInputLayout
的默认行为var submitWindow = window.open("/", "processingWindow");
submitWindow.location.href = 'about:blank';
submitWindow.location.href = 'remotePage to comunicate with';
答案 1 :(得分:0)
就像将hintEnabled设置为false一样简单:
textInputLayout.isHintEnabled = false