Search code examples
androidandroid-cardview

Expand and collapse CardView


What is the proper way to expand a CardView?

example


Solution

  • Use an expandable list view with cardview

    or even

    You can use wrap content as height of cardview and use textview inside it below title, so on click make the textview visible and vice-versa.

    but isn't it bad design ?

    nope it isn't if you give some transition or animation when it's expanded or collapsed

    If you want to see some default transition then just write android:animateLayoutChanges="true" in parent layout.