【发布时间】:2012-03-24 20:59:41
【问题描述】:
假设我有几个片段:
public class FirstFragment extends Fragment { ... }
public class SecondFragment extends Fragment { ... }
public class ThirdFragment extends Fragment { ... }
我还有一个主要的activity,它的内容是(main.xml):
<LinearLayout ...>
<!-- How to have a fragment placehold without specify which fragment show here? -->
<fragment>
</LinearLayout>
我的问题是,在上面的布局文件中,如何在不指定此处显示哪个片段的情况下定义 片段占位符,然后在我的活动 java 代码中,膨胀一个占位符的正确片段?
有没有可能,怎么做?
【问题讨论】:
标签: android android-layout android-intent android-fragments android-activity