1.取消延长动画时间办法解决焦点问题,更改为组件发生滚动取消获取焦点即可

This commit is contained in:
2026-03-16 15:36:29 +08:00
parent 724d4cff36
commit c7f0f1ef7b
2 changed files with 7 additions and 2 deletions

View File

@@ -880,7 +880,7 @@ public boolean onGenericMotionEvent(MotionEvent event) {
} }
}); });
translateAnimation.setDuration(380); translateAnimation.setDuration(300);
translateAnimation.setFillAfter(true); translateAnimation.setFillAfter(true);
content_view.startAnimation(translateAnimation); content_view.startAnimation(translateAnimation);
@@ -897,11 +897,12 @@ public boolean onGenericMotionEvent(MotionEvent event) {
cuttentModel = MODEL_NORMAL; cuttentModel = MODEL_NORMAL;
LogUtils.loge("coustom_view.getHeight():"+coustom_view.getLayoutParams().height); LogUtils.loge("coustom_view.getHeight():"+coustom_view.getLayoutParams().height);
TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, 0.0f,(float)(0 - coustom_view.getLayoutParams().height - gv_shortcut.getHeight()),0.0f); TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, 0.0f,(float)(0 - coustom_view.getLayoutParams().height - gv_shortcut.getHeight()),0.0f);
translateAnimation.setDuration(380); translateAnimation.setDuration(300);
translateAnimation.setAnimationListener(new Animation.AnimationListener() { translateAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override @Override
public void onAnimationStart(Animation animation) { public void onAnimationStart(Animation animation) {
coustom_view.setTranslationZ(0); coustom_view.setTranslationZ(0);
grid_coustom_apps.disScrollFocus();
loadShortAppList(); loadShortAppList();
coustom_view.clearFocus(); coustom_view.clearFocus();
} }

View File

@@ -129,6 +129,10 @@ public class TvRecyclerView extends RecyclerView {
LogUtils.loge("TvRecyclerView gainFocus="+gainFocus); LogUtils.loge("TvRecyclerView gainFocus="+gainFocus);
} }
} }
//防止失去焦点还是会继续滚动再度获取焦点
public void disScrollFocus(){
hasResetFocus=false;
}
@Override @Override
public boolean hasFocus() { public boolean hasFocus() {