Closed mobilekosmos closed 4 years ago
What does your Fragment layout look like?
RecyclerView should be inside a FrameLayout in your Fragment. You wouldn't need the wrapping FrameLayout in the XML you posted in that case.
"RecyclerView should be inside a FrameLayout in your Fragment." It doesn't matter if the FrameLayout is here or in the fragment!
And to answer your question, the fragment is only a recyclerView.
If your Fragment layout was a FrameLayout that held a RecyclerView, then everything would be fine.
You shouldn't be dependent on the host view of your Fragment, even without using the FragmentContainerView.
"If your Fragment layout was a FrameLayout that held a RecyclerView, then everything would be fine." Why do you say this? At the end the result is the same! The parent of the recyclerView is always the FrameLayout, it's doesn't matter where you put the frameLayout. And about dependency, also this lib shouldn't be dependent on using a frameLayout as a container to start with^^
Why do you say this? At the end the result is the same!
The end result is the sticky header won't be added to the FragmentContainerView, which is what is throwing the exception.
And about dependency, also this lib shouldn't be dependent on using a frameLayout as a container to start with^^
Thank you for your feedback. Feel free to fork this library or use another if it doesn't fit your needs.
The lib seems to be incompatible with the new FragmentContainerView that should be used instead of the deprecated "fragment". We are getting an illegal state exception while scrolling:
java.lang.IllegalStateException: Views added to a FragmentContainerView must be associated with a Fragment. View android.widget.LinearLayout{7e6e6e1 I.E...... ......ID 0,0-0,0 #7f0901af app:id/header_view} is not associated with a Fragment. at androidx.fragment.app.FragmentContainerView.addView(FragmentContainerView.java:276) at android.view.ViewGroup.addView(ViewGroup.java:4868) at android.view.ViewGroup.addView(ViewGroup.java:4841) at com.brandongogetap.stickyheaders.StickyHeaderPositioner.attachHeader(StickyHeaderPositioner.java:242) at com.brandongogetap.stickyheaders.StickyHeaderPositioner.updateHeaderState(StickyHeaderPositioner.java:73) at com.brandongogetap.stickyheaders.StickyLayoutManager.scrollVerticallyBy(StickyLayoutManager.java:95) at androidx.recyclerview.widget.RecyclerView.scrollStep(RecyclerView.java:1841) at androidx.recyclerview.widget.RecyclerView.scrollByInternal(RecyclerView.java:1940) at androidx.recyclerview.widget. 2020-03-27 03:17:43.909 22570-22570/com.sophos.smsec E/AndroidRuntime: at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7915) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7876) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:8091) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:219) at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method) at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:199) at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:8042) at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:8120) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972) at android.view.Choreographer.doCallbacks(Choreographer.java:796) at android.view.Choreographer.doFrame(Choreographer.java:724) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957) at android.os.Handler.handleCallback(Handler.java:907)