Android Viewpager 当一个Fragment中存在ScrollView时,滑动出现崩溃。
天蓬老师
天蓬老师 2017-04-17 17:22:50
0
2
689

如题,崩溃log如下:

java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to android.widget.ScrollView$SavedState
                                                                          at android.widget.ScrollView.onRestoreInstanceState(ScrollView.java:1806)
                                                                          at android.view.View.dispatchRestoreInstanceState(View.java:14042)
                                                                          at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3018)
                                                                          at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3024)
                                                                          at android.view.View.restoreHierarchyState(View.java:14020)
                                                                          at android.app.Fragment.restoreViewState(Fragment.java:645)
                                                                          at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:926)
                                                                          at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1079)
                                                                          at android.app.BackStackRecord.run(BackStackRecord.java:852)
                                                                          at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1485)
                                                                          at android.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:493)
                                                                          at android.support.v13.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:167)
                                                                          at android.support.v4.view.ViewPager.populate(ViewPager.java:1106)
                                                                          at android.support.v4.view.ViewPager.populate(ViewPager.java:952)
                                                                          at android.support.v4.view.ViewPager$3.run(ViewPager.java:251)
                                                                          at android.support.v4.view.ViewPager.completeScroll(ViewPager.java:1849)
                                                                          at android.support.v4.view.ViewPager.onInterceptTouchEvent(ViewPager.java:1978)
                                                                          at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2000)
                                                                          at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2523)
                                                                          at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2114)
                                                                          at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2523)
                                                                          at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2114)
                                                                          at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2523)
天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

全部回覆(2)
洪涛

格式轉換異常,繼承父VIEW的多個子類別時,因為設定view 的id重複。修改下重複id就可以了

左手右手慢动作

應該要貼下程式碼的,如題的介面我也用過並無問題。

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板