0

I want to create an expandable layout that holds view inside of it. And I should be able to toggle the height of it by pressing a button. The thing that I'm looking for is something like this:

enter image description here

This screen is divided in two parts. The upper part is expandable and holds text,webview... and the lower part has a list that changes the content in the upper expandable layout/view

Does anyone knows how can I achieve this, is there a library that I can use, or how should I implement such layout.

Thanks

CRUSADER
  • 5,486
  • 3
  • 28
  • 64
Darko Petkovski
  • 3,892
  • 13
  • 53
  • 117

4 Answers4

0

Yes, you can with ExpandableListView if your views are inside a ListView.

Otherwise, with Animations for making the view to appear.

  • added this to my question: This screen is divided in two parts. The upper part is expandable and holds text,webview... and the lower part has a list that changes the content in the upper expandable layout/view. – Darko Petkovski May 02 '14 at 13:59
  • Don't you succeed in doing it with animations ? –  May 02 '14 at 14:00
  • With something like that, you can change the size of your upper view : http://stackoverflow.com/questions/14454710/can-android-animation-change-views-size –  May 02 '14 at 14:02
0

You can do magic in layout itself. See this example.

Accordion Panel

Understand where to place and do your stuff. Hope this might help you.

Shadow
  • 6,864
  • 6
  • 44
  • 93
0

You can create groups where you can have expand button or imageView, underneath you can have nested Layout with content that you want to expand. Basicaly you want to place expandable content inside layout that will be one group and to be initially set to visiblity = View.GONE on click change to Visibility.Visible.

Remember that visibility = View.GONE set on View ensures that this view wont be rendered and will not take place in your layout , so you wont have to worry about height or width you can set it to wrap_content when you will change visibility to Visible then it will be rendered and any items below will be shifted down.

user3455363
  • 408
  • 1
  • 5
  • 13
0

I'm using ExpandableView that works perfect. It's a container and you can put a Relative or Linear layout in it.

Mahdi Moqadasi
  • 2,029
  • 4
  • 26
  • 52