Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error #11

Open
smarthityou opened this issue Aug 24, 2016 · 4 comments
Open

error #11

smarthityou opened this issue Aug 24, 2016 · 4 comments

Comments

@smarthityou
Copy link

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播放视频 然后出现这个问题了

@xiepeijie
Copy link
Owner

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

@smarthityou
Copy link
Author

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

@xiepeijie
Copy link
Owner

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

@smarthityou
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants