Android 为什么在使用moondroid coverflow时会出现NullPointerException?
我是android开发的初学者,我正在使用(外部库)创建CoverFlow,但我不明白为什么在XML中使用它时会出现空指针异常 这是我的XML文件:Android 为什么在使用moondroid coverflow时会出现NullPointerException?,android,coverflow,Android,Coverflow,我是android开发的初学者,我正在使用(外部库)创建CoverFlow,但我不明白为什么在XML中使用它时会出现空指针异常 这是我的XML文件: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layo
<?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>
请看一看示例,它是这样设置的
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:coverflow="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/darker_gray"
tools:context="it.moondroid.carousellayoutdemo.CoverFlowActivity">
<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"
coverflow:spacing="0.6" />
<TextSwitcher
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="16dp"
android:layout_alignParentBottom="true"
android:layout_centerVertical="true" />
</RelativeLayout>
并添加一些附加文件
请看一下请看一下示例,它是这样设置的
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:coverflow="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/darker_gray"
tools:context="it.moondroid.carousellayoutdemo.CoverFlowActivity">
<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"
coverflow:spacing="0.6" />
<TextSwitcher
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="16dp"
android:layout_alignParentBottom="true"
android:layout_centerVertical="true" />
</RelativeLayout>
并添加一些附加文件
只要看一下我们就需要更多的stacktace和代码来help@Emmanuel我已经提供了剩余的堆栈跟踪,我们需要更多的堆栈跟踪和代码来help@Emmanuel我已经提供了剩余的堆栈跟踪。您在xml中得到红线了吗?添加java代码coverflow可以工作,但当我滚动它时,应用程序崩溃,它给我以下错误“java.lang.NullPointerException:尝试从空对象引用上的'int android.view.view.mViewFlags'字段读取”好的,如果我只有一个图像要显示,我不希望它无限显示,我不想要一个无休止的循环解决方案是什么如果你不能设置这个库,那么试着使用这个我正在使用处理程序postDelayed 200延迟时间,所以在删除处理程序错误后…可能对某人有帮助。。。!!!xml中有红线吗?添加java代码coverflow可以工作,但当我滚动它时,应用程序崩溃,它给我以下错误“java.lang.NullPointerException:尝试从空对象引用上的'int android.view.view.mViewFlags'字段读取”好的,如果我只有一个图像要显示,我不希望它无限显示,我不想要一个无休止的循环解决方案是什么如果你不能设置这个库,那么试着使用这个我正在使用处理程序postDelayed 200延迟时间,所以在删除处理程序错误后…可能对某人有帮助。。。!!!