【问题标题】:it is possible to put different layouts for child items in ExpandableListView?是否可以在 ExpandableListView 中为子项放置不同的布局?
【发布时间】:2015-05-14 12:49:08
【问题描述】:

我是 android 的新开发人员,我正在尝试在可扩展列表视图中为子项放置不同的布局,但我找不到完整的教程来执行此操作,因此如果可能的话,请帮助此类可扩展列表视图的优秀教程或简单代码源的链接。 谢谢

【问题讨论】:

  • 您需要为每个组或每个孩子设置不同的布局吗?
  • 对于每个孩子,我的班级可以从 ListFragment 扩展

标签: java android listview android-studio expandablelistview


【解决方案1】:

http://www.techiecommunity.net/Android/Android-ExpandableListView-Layout-Example 本教程可以解决我的问题中提到的问题,但我仍然有一个问题,因为我的类可扩展 ListFragment 并且对于此示例扩展 ExpandableListActivity,所以有一个解决方案??

【讨论】:

    【解决方案2】:

    只是不要扩展ExpandableListActivity。我还扩展了Fragment,它工作正常。

    然后使用正确的方法:

    ((ExpandableListView) getView().findViewById( R.id.list).setAdapter( m_expandableListAdapter);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-07-01
      • 1970-01-01
      • 2017-05-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-10
      相关资源
      最近更新 更多