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(); } } });