I have a RecyclerView
in a LinearLayout
, which also contains an EditText
.
The container Activity has android:windowSoftInputMode="adjustResize|stateHidden"
set - so when the soft input opens, the RecyclerView
shrinks because it's space has been readjusted.
Unfortunately, when you click the EditText
causing the soft input to open, the following exception is thrown. I'm assuming this is another bug with the Android Support Library - can anyone confirm and perhaps suggest a work around?
java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled. isScrap:false isAttached:true
at android.support.v7.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:4570)
at android.support.v7.widget.RecyclerView$Recycler.quickRecycleScrapView(RecyclerView.java:4642)
at android.support.v7.widget.RecyclerView$LayoutManager.removeAndRecycleScrapInt(RecyclerView.java:6636)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2811)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3011)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:581)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
Edit
I spent the last several hours slowly deconstructing my project, until the problem went away. I then reversed by changes after lunch. In a fit of insanity inducing madness, reversing the changes hasn't reintroduced the bug.
I am still 100% snookered by what this bug is, I begin to worry either I'm mad or there is an intermittent cause to this bug which has temporarily gone away :(