From 766a5994589aac462b0fbe0742083257172d168f Mon Sep 17 00:00:00 2001 From: wushaocheng <15876365887@163.com> Date: Tue, 28 Feb 2023 00:19:55 +0800 Subject: [PATCH] =?UTF-8?q?[Modify]=E4=BF=AE=E5=BE=A9=E5=85=AC=E6=9C=83?= =?UTF-8?q?=E6=B6=88=E6=81=AFbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../erban/ui/im/MessageListPanelEx.java | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/yizhuan/erban/ui/im/MessageListPanelEx.java b/app/src/main/java/com/yizhuan/erban/ui/im/MessageListPanelEx.java index b9f65c369..9824240b1 100644 --- a/app/src/main/java/com/yizhuan/erban/ui/im/MessageListPanelEx.java +++ b/app/src/main/java/com/yizhuan/erban/ui/im/MessageListPanelEx.java @@ -966,21 +966,25 @@ public class MessageListPanelEx { messageListView.post(() -> { RecyclerView.LayoutManager layoutManager = messageListView.getLayoutManager(); if (layoutManager != null) { - View view = layoutManager.findViewByPosition(index); - RelativeLayout relativeLayout = (RelativeLayout) view; //获取布局中任意控件对象 - FrameLayout frameLayout = null; - if (relativeLayout != null) { - frameLayout = relativeLayout.findViewById(R.id.message_item_content); - } - if (frameLayout != null) { - //透明度起始为1,结束时为0 - ObjectAnimator animator = ObjectAnimator.ofFloat(frameLayout, "alpha", 0f, 1f); - animator.setDuration(1000);//时间1s - animator.setRepeatCount(1); - animator.setRepeatMode(ValueAnimator.RESTART); - animator.start(); + try { + View view = layoutManager.findViewByPosition(index); + RelativeLayout relativeLayout = (RelativeLayout) view; //获取布局中任意控件对象 + FrameLayout frameLayout = null; + if (relativeLayout != null) { + frameLayout = relativeLayout.findViewById(R.id.message_item_content); + } + if (frameLayout != null) { + //透明度起始为1,结束时为0 + ObjectAnimator animator = ObjectAnimator.ofFloat(frameLayout, "alpha", 0f, 1f); + animator.setDuration(1000);//时间1s + animator.setRepeatCount(1); + animator.setRepeatMode(ValueAnimator.RESTART); + animator.start(); - isShowAnim = true; + isShowAnim = true; + } + }catch (Exception e){ + e.printStackTrace(); } } });