hemanth kumar
hemanth kumar

Reputation: 3078

How to display data in android page using Accordion?

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.

Upvotes: 3

Views: 22522

Answers (2)

Riya Gayasen
Riya Gayasen

Reputation: 81

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

Upvotes: 1

Kwenk
Kwenk

Reputation: 123

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

Upvotes: 5

Related Questions