我想在android.support.design中使用很好的设计选项,但是有一个问题。
当我将FocusChanged FocusChanged设置为TextInputLayout中的EditText )时,TextInputLayout不能正常工作,而的浮动文本总是保持在带有重音颜色的编辑文本的顶部。(TextInputLayout不更新自身)
有办法解决这个问题吗?!
我正在用xamarin制作我的应用程序,但是如果你给我java代码的话,就没有问题了,。
发布于 2015-09-01 11:39:05
当您将自定义onFocusChangedListener设置为EditText时,您重写了onFocusChangedListener,但仍然可以使用旧的onFocusChangedListener,这是事实。要做到这一点,您需要在重写之前得到它。
final View.OnFocusChangeListener oldNameFocusListener = textInputLayout.getEditText().getOnFocusChangeListener();
textInputLayout.getEditText().setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
oldNameFocusListener.onFocusChange(v, hasFocus);
}
});这个问题可以在旧的设计库中找到,在新版本(v23.0.0)中,这个问题是固定的。
发布于 2015-08-05 10:14:42
我找到了答案。不小心,我在布局中点击了一个单选按钮,我看到TextInputLayout更新了,浮动标签改变了,我发现如果布局刷新TextInputLayout更新。所以我把这个添加到我的FocusChanged (onFocusChangedListener in android)方法中。
((TextView)sender).Text = ((TextView)sender).Text;
发布于 2015-08-12 08:20:21
当您为onFocusChangedListener设置自定义EditText时,可以重写由TextInputLayout设置的onFocusChangedListener。因此,没有办法将onFocusChangedListener与TextInputLayout结合使用。
https://stackoverflow.com/questions/31794016
复制相似问题