【问题标题】:How to display data in android page using Accordion?如何使用 Accordion 在 android 页面中显示数据?
【发布时间】:2016-10-22 17:14:57
【问题描述】:

我需要显示客户的详细信息。我需要使用 Accordion 来显示详细信息。任何人都可以建议如何在android中做到这一点?请帮我解决这个问题。

【问题讨论】:

    标签: android


    【解决方案1】:

    【讨论】:

      【解决方案2】:

      有很多方法可以做到这一点。一种方法是定义线性布局。添加不同的 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>
      

      这会渲染一个像这样的手风琴

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-10-22
        • 1970-01-01
        • 2020-12-18
        • 2012-11-25
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多