views:

996

answers:

2

I'm looking at best way of creating Accordion-style widget such as on this page Is there a way of achieving same effect using standard Android toolkit or do I need to build custom widget? If so - which one would you recommend extending if any?

Thanks a lot for your suggestions

+1  A: 

And in case you still wonder - this can be pretty much done with pair of button/layout stacked inside of the linear layout. Pseudo code follows

<LinearLayout android:orientation="vertical">
    <Button android:text="Panel 1"/>
    <SomeKindOfLayout android:id="@+id/panel1">
            <!-- widgets in first panel go here -->
    </SomeKindOfLayout>
    <Button android:text="Panel 2"/>
    <SomeKindOfLayout android:id="@+id/panel2" android:visibility="gone">
            <!-- widgets in second panel go here -->
    </SomeKindOfLayout>
    <Button android:text="Panel 3"/>
    <SomeKindOfLayout android:id="@+id/panel3" android:visibility="gone">
            <!-- widgets in third panel go here -->
    </SomeKindOfLayout>
    <Button android:text="Panel 4"/>
    <SomeKindOfLayout android:id="@+id/panel4" android:visibility="gone">
            <!-- widgets in fourth panel go here -->
    </SomeKindOfLayout></LinearLayout>

Another thing to possibly try is stacking ExpandableListView-s on top of each other

DroidIn.net
Hey, that code looks familiar... ;-)
CommonsWare
I had to share it with the world :) For the record - this is a snippet given to me by @commonsguy on the maillist (android.developers)
DroidIn.net
Hellow I am dynamiaclly creating the buttons for the accordion as its not sure about the number of button in the list. for every button I have LinearLayout with some views inside it. Can anybody let me know how to get the onclicklistner of the respective accordion button, so that I can toggle between visiblity and Gone for respective LinearLayouts.
Vinayak.B
A: 

Sorry that I am posting a question in the answer section. I found no way to continue this discussion.

Hi @Droidln.net, If you had success in creating the Accordion-style widget in this way please do share the clear Idea of how to do it.

It will be great if you share.

Vinayak.B
I would suggest posting your question and providing link back to this thread
DroidIn.net