我是一名Android開發的初學者,我使用moondroid CoverFlow(外部庫)創建CoverFlow,但我不明白爲什麼我在XML中使用它時會出現空指針異常。爲什麼在使用moondroid coverflow時會出現NullPointerException?
這裏是我的XML文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:coverflow="http://schemas.android.com/tools">
<it.moondroid.coverflow.components.ui.containers.FeatureCoverFlow
android:id="@+id/coverflow"
android:layout_width="match_parent"
android:layout_height="match_parent"
coverflow:coverHeight="@dimen/cover_height"
coverflow:coverWidth="@dimen/cover_width"
coverflow:maxScaleFactor="1.5"
coverflow:reflectionGap="0px"
coverflow:rotationThreshold="0.5"
coverflow:scalingThreshold="0.5">
</it.moondroid.coverflow.components.ui.containers.FeatureCoverFlow>
</RelativeLayout>
這裏是我得到的錯誤是:
java.lang.NullPointerExceptio at it.moondroid.coverflow.components.ui.containers.FeatureCoverFlow.dispatchDraw(FeatureCoverFlow.java:471)
at android.view.View.draw(View.java:16974) at android.view.ViewGroup.drawChild_Original(ViewGroup.java:3764) at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:61) at android.view.ViewGroup.drawChild(ViewGroup.java:3764) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3550) at android.view.View.draw(View.java:16974) at android.view.ViewGroup.drawChild_Original(ViewGroup.java:3764) at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:61) at android.view.ViewGroup.drawChild(ViewGroup.java:3764) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3550) at android.view.View.draw(View.java:16974) at android.view.ViewGroup.drawChild_Original(ViewGroup.java:3764) at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:61) at android.view.ViewGroup.drawChild(ViewGroup.java:3764) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3550) at android.view.View.draw(View.java:16974) at android.view.ViewGroup.drawChild_Original(ViewGroup.java:3764) at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:61) at android.view.ViewGroup.drawChild(ViewGroup.java:3764) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3550) at android.view.View.draw(View.java:17071)
我們需要更多的stacktace和代碼,以幫助 – Emmanuel
@Emmanuel我提供其餘的堆棧跟蹤 – Abhinav422