Code Monkey home page Code Monkey logo

Comments (10)

cachapa avatar cachapa commented on July 21, 2024

Can you show me the layout xml?

Does the code work if you use a simply LinearLayout instead of an ExpandableLinearLayout? I'm not sure RecyclerView is meant to be used with WRAP_CONTENT. Generally you'd use it with either MATCH_PARENT, a given weight, or a fixed height.

from expandablelayout.

chowaikong avatar chowaikong commented on July 21, 2024

Here is XML that won't work:
qq 20160530124431

RecyclerView support WARP_CONTENT since 23.2.0 already.

from expandablelayout.

cachapa avatar cachapa commented on July 21, 2024

What happens if you set layout_expanded="true" in your RecyclerView?

Can you link me to the release notes where it says RecyclerView supports WRAP_CONTENT since 23.3.0?
My understanding was that the change was related to MATCH_PARENT in the item views. It still makes no sense to me for RecyclerView to support WRAP_CONTENT since its content are the items.
For the RV to wrap the content would mean it taking the height of the sum of it's items, essentially disabling scrolling and becoming a complex LinearLayout.

from expandablelayout.

chowaikong avatar chowaikong commented on July 21, 2024

http://android-developers.blogspot.hk/2016/02/android-support-library-232.html
You can see RecyclerView support WARP_CONTENT in the link above, and I quote "This means that previously unavailable scenarios, such as using WRAP_CONTENT for a dimension of the RecyclerView, are now possible.".
I have simplify the code I post in the last comment, of course I have set layout_expanded="true" in RecyclerView in my production code.
Yes, my understanding is similar to yours, the expandable layout must set a fixed height or it will collapse the WRAP_CONTENT layout, so my suggestion is SUPPORT WRAP_CONTENT LAYOUT.

from expandablelayout.

cachapa avatar cachapa commented on July 21, 2024

You're right, WRAP_CONTENT should work in the newer versions of RV.

Did you edit your earlier post with the layout? I first saw it on my phone as text, but now it seems that it's a screenshot. I'm asking because now I'm not sure if I'm looking at the same layout file.

In any case, there are a few problems with your XML:

  • You set el_expanded="false", which will cause the layout to start in the collapsed state.
  • The above makes no difference since none of the child layouts are set as expandable="true".

I have tested a few variations of the issue from your earlier description in the included demo app, and couldn't replicate the problem.
Could you try replicating the problem in the demo? It's easier for me to fix the bug if I can replicate the problem here.

from expandablelayout.

chowaikong avatar chowaikong commented on July 21, 2024

But wait, setting el_expanded="false" isn't in order to set the expandable layout collapsed by default?

from expandablelayout.

cachapa avatar cachapa commented on July 21, 2024

Yes. In your original report you said the layout was starting collapsed, that's why I mentioned it.

from expandablelayout.

chowaikong avatar chowaikong commented on July 21, 2024

I found the reason for this problem, because I am using a custom RecyclerView called SuperRecyclerView, it's extends FrameLayout, so I wrap a fixed height LinearLayout with SuperRecyclerView works. RecyclerView from the support lib works fine in your demo, my requirement makes me have to use a custom RecyclerView.

from expandablelayout.

chowaikong avatar chowaikong commented on July 21, 2024

So it maybe the problem is mine.

from expandablelayout.

cachapa avatar cachapa commented on July 21, 2024

Ok, thanks for clarifying

from expandablelayout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.