【问题标题】:Do an Activity Inside Fragment在 Fragment 中执行 Activity
【发布时间】:2013-05-14 18:51:28
【问题描述】:

我做了这个人的tutorial 关于如何制作一个 ActionBar 并严格按照他的指示进行操作。他做了两个标签来展示两个片段,片段A和片段B。

在此之前,我的启动器 MainActivity 上有一个 ExpandedListView,由于 MainActivity.xml 现在包含选项卡的片段容器,我如何将 ExpandedListView 移动到第一个或第二个片段?

在我实现 ActionBar 之前,我的 MainActivity.xml 包含一个 ExpandableListView。

然后我用两个选项卡实现了 ActionBar,Fragment A 和 Fragment B。如何将 ExpandableListView 移动到这些选项卡之一中?我希望有人花时间阅读他的教程,因为它的布局与我的几乎相同,因为我只是复制了它。

【问题讨论】:

    标签: android android-fragments


    【解决方案1】:

    我相信,没有ExpandedListFragment。可能他们决定不支持 ExpandedListView 作为片段,因为 ExpandedListView 是一个看起来很奇怪的 UI 控件。您可能需要考虑使用多个ListFragments

    【讨论】:

    • 您好,我在我的问题上添加了更多详细信息。 :(
    • 我相信您可以为您的片段定义一个布局,该布局将包含您的 ExpandableListView。然后在片段的 onCreateView 中扩展此布局。这样你就可以将 ExpandableListView 作为布局中的视图之一。然后在 onCreateView 中为 ExpandableListView 等设置一个适配器
    • stackoverflow.com/questions/16578543/… 我在片段切换时显示不同的 xml 时遇到问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-14
    • 2014-12-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多