3

I need to display details of a customer. I need to use Accordion to display the details. Can anybody suggest how to do that in android? Please help me regarding this.

hemanth kumar
  • 3,068
  • 10
  • 41
  • 64

2 Answers2

5

It is possible. There are a lot of ways to do it. For example visit Android - accordion widget or http://android-puremvc-ormlite.blogspot.com/2011/07/android-simple-accordion-panel.html

Community
  • 1
  • 1
Kwenk
  • 123
  • 4
1

There are many ways of doing it. One way is to define a linear layout. Add different TextViews to signify the heading and the body.

Or, you can use my Accordion View component for your purpose. It already has the different components defined like the heading and the body. To add the UI elements to the body, simply add them in the XML file, the way you add elements to a RelativeLayout.

<com.riyagayasen.easyaccordion.AccordionView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentStart="true"
    android:visibility="visible"
    app:isAnimated="false"
    app:heading="This is a demo accordion"
    app:isExpanded="true"
    app:isPartitioned="true">

    <TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Demo accordion text" />

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Test Button"
        android:id="@+id/button_2"
        android:layout_below="@+id/textView" />
    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Test Button 2"
        android:layout_below="@+id/button_2" />
</com.riyagayasen.easyaccordion.AccordionView>

This renders an accordion like this

The demo accordion

Riya Gayasen
  • 81
  • 1
  • 8