New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why does my expanded content cause an overflow? #313
Comments
Hi @chenasraf Sorry for not catching your SO post. What do you mean by overflow? could you highlight what you are seeing happen incorrectly in the screenshots? What is the drawable |
The actual problem is - if you look at the initial scr, you will see 4 items. In examples 1 & 2, any open accordion seems to push the other ones down to clear space for the expansion (so far so good), but the overall height of the viewport only fits 4, so when one is expanded and takes the space of 1 more item, you eventually see only 3 while 1 is overflown below the break. |
Oh I see, what is the xml of your fragment/activity that has the RecyclerView, looks like you may be using wrap content? |
Yes, I am. Anything else I tried broke the layout even more, what do you suggest? The XML is in my original post :) |
The XML I'm looking for is something that contains your RecyclerView, something like (I don't see it in the original post but I might be wrong!): <?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"/> I haven't tried to use a RecyclerView with wrap_content so I'm not sure of what part is not adapting to the change in size, that should not be affected by the adapter since we are simply notifying and adding/removing items. My suggestion would be to try and use match parent for the RecyclerView, I don't see how that might break the layout since there are no items below it (but maybe there is more to this layout). |
Sorry then, my bad. Did you mean this? <?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/list"
android:name="com.csheet.d20.adventure_mode.inventory.InventoryFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
app:layoutManager="LinearLayoutManager"
tools:context="com.csheet.d20.adventure_mode.inventory.InventoryFragment"
tools:listitem="@layout/fragment_inventory" /> |
And that version is still clipping your views? |
@paul-turner yep :( |
@chenasraf Otherwise, something is cutting off your recyclerview from displaying all the items, the adapter does not affect any of the layout of RecyclerView so it is unlikely this is an issue with the library. Those would be my last guesses without being able to run the code, if you can recreate it with a small sample that would be great. Otherwise, maybe screenshots with show layout bounds enabled might help. |
original SO question
I have an ExpandableRecyclerView, following this article. However, when I test my code, here's what happens when I expand items:
Initial view | Expanded: Example 1, Example 2
Here's my fragment
onCreateView
:The
LinearLayoutManagerWrapper
extendsLinearLayoutManager
and the only difference is it catchesIndexOutOfBound
exceptions caused due to some library bugs (took it from another SO question).Here's my
ParentViewHolder
'sbind
method (which I call inside myViewAdapter
'sonBindParentViewHolder
:Here's my fragment view xml (ignore the static params, I'll extract them soon):
And my child's xml (the expanded area):
The text was updated successfully, but these errors were encountered: