gpt4 book ai didi

android - 过渡动画后 EditText 提示不可见

转载 作者:搜寻专家 更新时间:2023-11-01 09:35:12 25 4
gpt4 key购买 nike

我想用过渡动画为 EditText 设置动画。完成动画后,提示不会显示,但是当我调用 edittext.requestLayout 或当用户聚焦到 edittext 提示时会出现。 requestLayout 听起来像是一种变通方法什么是真正的解决方案?

final EditText text = (EditText) findViewById(R.id.editText);
AutoTransition autoTransition = new AutoTransition();
TransitionSet transitionSet = new TransitionSet();
transitionSet.addTransition(autoTransition);
transitionSet.setDuration(2000);
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) text.getLayoutParams();
params.width = 0;
params.height = 0;
text.setLayoutParams(params);
transitionSet.addListener(new Transition.TransitionListener() {
@Override
public void onTransitionStart(@NonNull Transition transition) {

}

@Override
public void onTransitionEnd(@NonNull Transition transition) {
AutoTransition autoTransition = new AutoTransition();
TransitionSet transitionSet = new TransitionSet();
transitionSet.addTransition(autoTransition);
transitionSet.setDuration(2000);
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) text.getLayoutParams();
params.width = -2;
params.height = -2;
text.setLayoutParams(params);
TransitionManager.beginDelayedTransition((ViewGroup) text.getParent(), transitionSet);
}

@Override
public void onTransitionCancel(@NonNull Transition transition) {

}

@Override
public void onTransitionPause(@NonNull Transition transition) {

}

@Override
public void onTransitionResume(@NonNull Transition transition) {

}
});
TransitionManager.beginDelayedTransition((ViewGroup) text.getParent(), transitionSet);
}

最佳答案

问题是与支持转换相关的 Android 错误及其 resolved在支持 27.1.1 中。

关于android - 过渡动画后 EditText 提示不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43910143/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com