1

我正在尝试使用 android-support-v4-googlemaps: https ://github.com/petedoyle/android-support-v4-googlemaps 和 view-pager-indicator: https ://github.com/JakeWharton/Android-ViewPagerIndicator

可悲的是,当我插入地图片段时,我收到了一个异常(粘贴在此消息的末尾),我无法推断出原因是什么。我从 android-support-v4-googlemaps 运行示例项目,一切正常。

当我从 FragmentLayoutMaps(来自 android-support-v4-googlemaps 的示例项目的名称)导入类时,我可以将 TitlesFragment 添加到我的项目中并且一切运行顺利,但是添加 MapFragment 会引发此异常:

06-06 17:24:21.306: E/AndroidRuntime(6279): FATAL EXCEPTION: main
06-06 17:24:21.306: E/AndroidRuntime(6279):
java.lang.ClassCastException:
com.viewpagerindicator.sample.MappaTabsActivity
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
com.example.android.apis.app.FragmentLayout
$MapFragment.onCreateView(FragmentLayout.java:245)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:
870)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:
1080)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.support.v4.app.BackStackRecord.run(BackStackRecord.java:622)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:
1416)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:
431)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:
139)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.support.v4.view.ViewPager.populate(ViewPager.java:804)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:
433)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:
405)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:386)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
com.viewpagerindicator.TabPageIndicator.setCurrentItem(TabPageIndicator.java:
230)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
com.viewpagerindicator.TabPageIndicator.onMeasure(TabPageIndicator.java:
115)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.view.View.measure(View.java:8322)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:
1017)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.view.View.measure(View.java:8322)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.view.View.measure(View.java:8322)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.widget.LinearLayout.measureVertical(LinearLayout.java:531)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.view.View.measure(View.java:8322)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.view.View.measure(View.java:8322)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.view.ViewRoot.performTraversals(ViewRoot.java:842)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.view.ViewRoot.handleMessage(ViewRoot.java:1862)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.os.Handler.dispatchMessage(Handler.java:99)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.os.Looper.loop(Looper.java:130)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
android.app.ActivityThread.main(ActivityThread.java:3806)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
java.lang.reflect.Method.invokeNative(Native Method)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
java.lang.reflect.Method.invoke(Method.java:507)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-06 17:24:21.306: E/AndroidRuntime(6279):     at
dalvik.system.NativeStart.main(Native Method)

有谁知道问题可能是什么?

谢谢,罗伯特

4

0 回答 0