ava.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to android.support.v7.widget.RecyclerView$LayoutParams

GitHub | studentapptdt | 7 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Crash when use scrollToPosition

    GitHub | 7 months ago | studentapptdt
    ava.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to android.support.v7.widget.RecyclerView$LayoutParams

    Root Cause Analysis

    1. ava.lang.ClassCastException

      android.widget.FrameLayout$LayoutParams cannot be cast to android.support.v7.widget.RecyclerView$LayoutParams

      at android.support.v7.widget.RecyclerView.getChildViewHolderInt()
    2. Android v7
      RecyclerView.onLayout
      1. android.support.v7.widget.RecyclerView.getChildViewHolderInt(RecyclerView.java:3979)
      2. android.support.v7.widget.RecyclerView$LayoutManager.removeAndRecycleScrapInt(RecyclerView.java:7719)
      3. android.support.v7.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:3388)
      4. android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3135)
      5. android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3568)
      5 frames
    3. Android Platform
      ViewGroup.layout
      1. android.view.View.layout(View.java:17938)
      2. android.view.ViewGroup.layout(ViewGroup.java:5812)
      3. android.widget.FrameLayout.layoutChildren(FrameLayout.java:344)
      4. android.widget.FrameLayout.onLayout(FrameLayout.java:281)
      5. android.view.View.layout(View.java:17938)
      6. android.view.ViewGroup.layout(ViewGroup.java:5812)
      7. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1742)
      8. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
      9. android.widget.LinearLayout.onLayout(LinearLayout.java:1494)
      10. android.view.View.layout(View.java:17938)
      11. android.view.ViewGroup.layout(ViewGroup.java:5812)
      12. android.widget.RelativeLayout.onLayout(RelativeLayout.java:1080)
      13. android.view.View.layout(View.java:17938)
      14. android.view.ViewGroup.layout(ViewGroup.java:5812)
      15. android.widget.FrameLayout.layoutChildren(FrameLayout.java:344)
      16. android.widget.FrameLayout.onLayout(FrameLayout.java:281)
      17. android.view.View.layout(View.java:17938)
      18. android.view.ViewGroup.layout(ViewGroup.java:5812)
      18 frames
    4. Android Support v4
      ViewPager.onLayout
      1. android.support.v4.view.ViewPager.onLayout(ViewPager.java:1767)
      1 frame
    5. Android Platform
      ViewGroup.layout
      1. android.view.View.layout(View.java:17938)
      2. android.view.ViewGroup.layout(ViewGroup.java:5812)
      2 frames
    6. android.support.design
      CoordinatorLayout.onLayout
      1. android.support.design.widget.HeaderScrollingViewBehavior.layoutChild(HeaderScrollingViewBehavior.java:131)
      2. android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42)
      3. android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1364)
      4. android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:852)
      4 frames
    7. Android Platform
      FrameLayout.onLayout
      1. android.view.View.layout(View.java:17938)
      2. android.view.ViewGroup.layout(ViewGroup.java:5812)
      3. android.widget.RelativeLayout.onLayout(RelativeLayout.java:1080)
      4. android.view.View.layout(View.java:17938)
      5. android.view.ViewGroup.layout(ViewGroup.java:5812)
      6. android.widget.FrameLayout.layoutChildren(FrameLayout.java:344)
      7. android.widget.FrameLayout.onLayout(FrameLayout.java:281)
      8. android.view.View.layout(View.java:17938)
      9. android.view.ViewGroup.layout(ViewGroup.java:5812)
      10. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1742)
      11. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
      12. android.widget.LinearLayout.onLayout(LinearLayout.java:1494)
      13. android.view.View.layout(View.java:17938)
      14. android.view.ViewGroup.layout(ViewGroup.java:5812)
      15. android.widget.FrameLayout.layoutChildren(FrameLayout.java:344)
      16. android.widget.FrameLayout.onLayout(FrameLayout.java:281)
      17. android.view.View.layout(View.java:17938)
      18. android.view.ViewGroup.layout(ViewGroup.java:5812)
      19. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1742)
      20. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
      21. android.widget.LinearLayout.onLayout(LinearLayout.java:1494)
      22. android.view.View.layout(View.java:17938)
      23. android.view.ViewGroup.layout(ViewGroup.java:5812)
      24. android.widget.FrameLayout.layoutChildren(FrameLayout.java:344)
      25. android.widget.FrameLayout.onLayout(FrameLayout.java:281)
      25 frames
    8. Android
      PhoneWindow$DecorView.onLayout
      1. com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:3193)
      1 frame
    9. Android Platform
      ViewRootImpl.performLayout
      1. android.view.View.layout(View.java:17938)
      2. android.view.ViewGroup.layout(ViewGroup.java:5812)
      3. android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2666)
      3 frames