【发布时间】:2016-10-22 17:14:57
【问题描述】:
我需要显示客户的详细信息。我需要使用 Accordion 来显示详细信息。任何人都可以建议如何在android中做到这一点?请帮我解决这个问题。
【问题讨论】:
标签: android
我需要显示客户的详细信息。我需要使用 Accordion 来显示详细信息。任何人都可以建议如何在android中做到这一点?请帮我解决这个问题。
【问题讨论】:
标签: android
【讨论】:
有很多方法可以做到这一点。一种方法是定义线性布局。添加不同的 TextView 来表示标题和正文。
或者,您可以使用my Accordion View component 来满足您的目的。它已经定义了不同的组件,例如标题和正文。要将 UI 元素添加到正文,只需将它们添加到 XML 文件中,就像将元素添加到 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>
这会渲染一个像这样的手风琴
【讨论】: