SwipeCardView icon indicating copy to clipboard operation
SwipeCardView copied to clipboard

error

Open smarthityou opened this issue 8 years ago • 4 comments

java.lang.NullPointerException at com.xiangying.view.custom.swipCard.SwipeFlingAdapterView.makeAndAddView(SwipeFlingAdapterView.java:166) at com.xiangying.view.custom.swipCard.SwipeFlingAdapterView.layoutChildren(SwipeFlingAdapterView.java:150) at com.xiangying.view.custom.swipCard.SwipeFlingAdapterView.onLayout(SwipeFlingAdapterView.java:127) at android.view.View.layout(View.java:14833) at android.view.ViewGroup.layout(ViewGroup.java:4631) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525) at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)

我是打算把demo中的图片位置换成viewview播放视频 然后出现这个问题了

smarthityou avatar Aug 24 '16 07:08 smarthityou

@smarthityou 按理只是替换控件,不会有问题,自己分析下,看还改了哪里

xiepeijie avatar Aug 27 '16 13:08 xiepeijie

在SwipeFlingAdapterView中的makeAndAddView中FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) child.getLayoutParams();下面各个获取lp.topMargin + lp.bottomMargin会报空指针

smarthityou avatar Sep 08 '16 02:09 smarthityou

@smarthityou 你不是用inflater.inflate(layoutId, parent, false)方法实例化view的吧,导致LayoutParams为空

xiepeijie avatar Sep 10 '16 03:09 xiepeijie

我是在适配器里面用的,但也不至于这样吧。然后我在child.getLayoutParams();下面各个获取lp.topMargin + lp.bottomMargin用了try语句 如果出错就不获取lp.topMargin + lp.bottomMargin然后就不会有问题了 。 还有个问题就是 如果加上videoView的话锯齿就更严重了。

smarthityou avatar Sep 10 '16 05:09 smarthityou